Average Error: 7.9 → 7.9
Time: 16.1s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\frac{x \cdot y - t \cdot z}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\frac{x \cdot y - t \cdot z}{a}
double f(double x, double y, double z, double t, double a) {
        double r39238564 = x;
        double r39238565 = y;
        double r39238566 = r39238564 * r39238565;
        double r39238567 = z;
        double r39238568 = t;
        double r39238569 = r39238567 * r39238568;
        double r39238570 = r39238566 - r39238569;
        double r39238571 = a;
        double r39238572 = r39238570 / r39238571;
        return r39238572;
}

double f(double x, double y, double z, double t, double a) {
        double r39238573 = x;
        double r39238574 = y;
        double r39238575 = r39238573 * r39238574;
        double r39238576 = t;
        double r39238577 = z;
        double r39238578 = r39238576 * r39238577;
        double r39238579 = r39238575 - r39238578;
        double r39238580 = a;
        double r39238581 = r39238579 / r39238580;
        return r39238581;
}

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.9
Target5.8
Herbie7.9
\[\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. Initial program 7.9

    \[\frac{x \cdot y - z \cdot t}{a}\]
  2. Taylor expanded around inf 7.9

    \[\leadsto \frac{\color{blue}{x \cdot y - t \cdot z}}{a}\]
  3. Final simplification7.9

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

Reproduce

herbie shell --seed 2019174 
(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))