Average Error: 7.8 → 0.8
Time: 11.6s
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 r49474385 = x;
        double r49474386 = y;
        double r49474387 = r49474385 * r49474386;
        double r49474388 = z;
        double r49474389 = t;
        double r49474390 = r49474388 * r49474389;
        double r49474391 = r49474387 - r49474390;
        double r49474392 = a;
        double r49474393 = r49474391 / r49474392;
        return r49474393;
}

double f(double x, double y, double z, double t, double a) {
        double r49474394 = x;
        double r49474395 = y;
        double r49474396 = r49474394 * r49474395;
        double r49474397 = z;
        double r49474398 = t;
        double r49474399 = r49474397 * r49474398;
        double r49474400 = r49474396 - r49474399;
        double r49474401 = -9.100960763329437e+207;
        bool r49474402 = r49474400 <= r49474401;
        double r49474403 = a;
        double r49474404 = r49474395 / r49474403;
        double r49474405 = r49474394 * r49474404;
        double r49474406 = r49474403 / r49474398;
        double r49474407 = r49474397 / r49474406;
        double r49474408 = r49474405 - r49474407;
        double r49474409 = 2.746849764792953e+224;
        bool r49474410 = r49474400 <= r49474409;
        double r49474411 = r49474400 / r49474403;
        double r49474412 = r49474403 / r49474395;
        double r49474413 = r49474394 / r49474412;
        double r49474414 = r49474398 / r49474403;
        double r49474415 = r49474414 * r49474397;
        double r49474416 = r49474413 - r49474415;
        double r49474417 = r49474410 ? r49474411 : r49474416;
        double r49474418 = r49474402 ? r49474408 : r49474417;
        return r49474418;
}

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))