Average Error: 7.5 → 0.7
Time: 2.9s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.63996417520049271 \cdot 10^{213} \lor \neg \left(x \cdot y - z \cdot t \le 8.535845682898131 \cdot 10^{268}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -1.63996417520049271 \cdot 10^{213} \lor \neg \left(x \cdot y - z \cdot t \le 8.535845682898131 \cdot 10^{268}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r825220 = x;
        double r825221 = y;
        double r825222 = r825220 * r825221;
        double r825223 = z;
        double r825224 = t;
        double r825225 = r825223 * r825224;
        double r825226 = r825222 - r825225;
        double r825227 = a;
        double r825228 = r825226 / r825227;
        return r825228;
}

double f(double x, double y, double z, double t, double a) {
        double r825229 = x;
        double r825230 = y;
        double r825231 = r825229 * r825230;
        double r825232 = z;
        double r825233 = t;
        double r825234 = r825232 * r825233;
        double r825235 = r825231 - r825234;
        double r825236 = -1.6399641752004927e+213;
        bool r825237 = r825235 <= r825236;
        double r825238 = 8.535845682898131e+268;
        bool r825239 = r825235 <= r825238;
        double r825240 = !r825239;
        bool r825241 = r825237 || r825240;
        double r825242 = a;
        double r825243 = r825230 / r825242;
        double r825244 = r825229 * r825243;
        double r825245 = r825242 / r825232;
        double r825246 = r825233 / r825245;
        double r825247 = r825244 - r825246;
        double r825248 = r825231 / r825242;
        double r825249 = r825233 * r825232;
        double r825250 = r825249 / r825242;
        double r825251 = r825248 - r825250;
        double r825252 = r825241 ? r825247 : r825251;
        return r825252;
}

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.5
Target6.0
Herbie0.7
\[\begin{array}{l} \mathbf{if}\;z \lt -2.46868496869954822 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.30983112197837121 \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 2 regimes
  2. if (- (* x y) (* z t)) < -1.6399641752004927e+213 or 8.535845682898131e+268 < (- (* x y) (* z t))

    1. Initial program 36.3

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

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

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

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

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

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

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

    if -1.6399641752004927e+213 < (- (* x y) (* z t)) < 8.535845682898131e+268

    1. Initial program 0.7

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

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t}{\frac{a}{z}}}\]
    7. Taylor expanded around 0 0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.63996417520049271 \cdot 10^{213} \lor \neg \left(x \cdot y - z \cdot t \le 8.535845682898131 \cdot 10^{268}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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

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