Average Error: 7.8 → 0.8
Time: 11.8s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -9.10096076332943717401674543850064881245 \cdot 10^{207}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 2.746849764792953097926317250912086301221 \cdot 10^{224}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t}{a} \cdot z\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -9.10096076332943717401674543850064881245 \cdot 10^{207}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{z}{\frac{a}{t}}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le 2.746849764792953097926317250912086301221 \cdot 10^{224}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t}{a} \cdot z\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r44711585 = x;
        double r44711586 = y;
        double r44711587 = r44711585 * r44711586;
        double r44711588 = z;
        double r44711589 = t;
        double r44711590 = r44711588 * r44711589;
        double r44711591 = r44711587 - r44711590;
        double r44711592 = a;
        double r44711593 = r44711591 / r44711592;
        return r44711593;
}

double f(double x, double y, double z, double t, double a) {
        double r44711594 = x;
        double r44711595 = y;
        double r44711596 = r44711594 * r44711595;
        double r44711597 = z;
        double r44711598 = t;
        double r44711599 = r44711597 * r44711598;
        double r44711600 = r44711596 - r44711599;
        double r44711601 = -9.100960763329437e+207;
        bool r44711602 = r44711600 <= r44711601;
        double r44711603 = a;
        double r44711604 = r44711595 / r44711603;
        double r44711605 = r44711594 * r44711604;
        double r44711606 = r44711603 / r44711598;
        double r44711607 = r44711597 / r44711606;
        double r44711608 = r44711605 - r44711607;
        double r44711609 = 2.746849764792953e+224;
        bool r44711610 = r44711600 <= r44711609;
        double r44711611 = r44711600 / r44711603;
        double r44711612 = r44711603 / r44711595;
        double r44711613 = r44711594 / r44711612;
        double r44711614 = r44711598 / r44711603;
        double r44711615 = r44711614 * r44711597;
        double r44711616 = r44711613 - r44711615;
        double r44711617 = r44711610 ? r44711611 : r44711616;
        double r44711618 = r44711602 ? r44711608 : r44711617;
        return r44711618;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.8
Target5.9
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;z \lt -2.468684968699548224247694913169778644284 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.309831121978371209578784129518242708809 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (- (* x y) (* z t)) < -9.100960763329437e+207

    1. Initial program 29.1

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub29.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied associate-/l*14.7

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{z}{\frac{a}{t}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity14.7

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot a}} - \frac{z}{\frac{a}{t}}\]
    8. Applied times-frac1.1

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{a}} - \frac{z}{\frac{a}{t}}\]
    9. Simplified1.1

      \[\leadsto \color{blue}{x} \cdot \frac{y}{a} - \frac{z}{\frac{a}{t}}\]

    if -9.100960763329437e+207 < (- (* x y) (* z t)) < 2.746849764792953e+224

    1. Initial program 0.8

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub0.8

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.8

      \[\leadsto \frac{x \cdot y}{a} - \frac{z \cdot t}{\color{blue}{1 \cdot a}}\]
    6. Applied times-frac5.6

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{z}{1} \cdot \frac{t}{a}}\]
    7. Simplified5.6

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{z} \cdot \frac{t}{a}\]
    8. Using strategy rm
    9. Applied associate-*r/0.8

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{z \cdot t}{a}}\]
    10. Applied sub-div0.8

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}}\]

    if 2.746849764792953e+224 < (- (* x y) (* z t))

    1. Initial program 34.2

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub34.2

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity34.2

      \[\leadsto \frac{x \cdot y}{a} - \frac{z \cdot t}{\color{blue}{1 \cdot a}}\]
    6. Applied times-frac18.2

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{z}{1} \cdot \frac{t}{a}}\]
    7. Simplified18.2

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{z} \cdot \frac{t}{a}\]
    8. Using strategy rm
    9. Applied associate-/l*0.7

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} - z \cdot \frac{t}{a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -9.10096076332943717401674543850064881245 \cdot 10^{207}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 2.746849764792953097926317250912086301221 \cdot 10^{224}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t}{a} \cdot z\\ \end{array}\]

Reproduce

herbie shell --seed 2019171 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"

  :herbie-target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

  (/ (- (* x y) (* z t)) a))