Average Error: 7.6 → 1.0
Time: 14.4s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -2.396745220130849389342734383033597419699 \cdot 10^{267} \lor \neg \left(x \cdot y - z \cdot t \le 5.738805671723125940775039794025364315771 \cdot 10^{184}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{1}{\frac{a}{t \cdot z}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -2.396745220130849389342734383033597419699 \cdot 10^{267} \lor \neg \left(x \cdot y - z \cdot t \le 5.738805671723125940775039794025364315771 \cdot 10^{184}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r59414 = x;
        double r59415 = y;
        double r59416 = r59414 * r59415;
        double r59417 = z;
        double r59418 = t;
        double r59419 = r59417 * r59418;
        double r59420 = r59416 - r59419;
        double r59421 = a;
        double r59422 = r59420 / r59421;
        return r59422;
}

double f(double x, double y, double z, double t, double a) {
        double r59423 = x;
        double r59424 = y;
        double r59425 = r59423 * r59424;
        double r59426 = z;
        double r59427 = t;
        double r59428 = r59426 * r59427;
        double r59429 = r59425 - r59428;
        double r59430 = -2.3967452201308494e+267;
        bool r59431 = r59429 <= r59430;
        double r59432 = 5.738805671723126e+184;
        bool r59433 = r59429 <= r59432;
        double r59434 = !r59433;
        bool r59435 = r59431 || r59434;
        double r59436 = a;
        double r59437 = r59424 / r59436;
        double r59438 = r59423 * r59437;
        double r59439 = r59436 / r59426;
        double r59440 = r59427 / r59439;
        double r59441 = r59438 - r59440;
        double r59442 = r59425 / r59436;
        double r59443 = 1.0;
        double r59444 = r59427 * r59426;
        double r59445 = r59436 / r59444;
        double r59446 = r59443 / r59445;
        double r59447 = r59442 - r59446;
        double r59448 = r59435 ? r59441 : r59447;
        return r59448;
}

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.6
Target6.2
Herbie1.0
\[\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 2 regimes
  2. if (- (* x y) (* z t)) < -2.3967452201308494e+267 or 5.738805671723126e+184 < (- (* x y) (* z t))

    1. Initial program 31.9

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{a}} - \frac{t \cdot z}{a}\]
    8. Simplified17.4

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

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

    if -2.3967452201308494e+267 < (- (* x y) (* z t)) < 5.738805671723126e+184

    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. Simplified0.8

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied clear-num1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -2.396745220130849389342734383033597419699 \cdot 10^{267} \lor \neg \left(x \cdot y - z \cdot t \le 5.738805671723125940775039794025364315771 \cdot 10^{184}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{1}{\frac{a}{t \cdot z}}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< z -2.46868496869954822e170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.30983112197837121e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

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