Average Error: 7.3 → 7.3
Time: 14.6s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\frac{x \cdot y + \left(-z \cdot t\right)}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\frac{x \cdot y + \left(-z \cdot t\right)}{a}
double f(double x, double y, double z, double t, double a) {
        double r558335 = x;
        double r558336 = y;
        double r558337 = r558335 * r558336;
        double r558338 = z;
        double r558339 = t;
        double r558340 = r558338 * r558339;
        double r558341 = r558337 - r558340;
        double r558342 = a;
        double r558343 = r558341 / r558342;
        return r558343;
}

double f(double x, double y, double z, double t, double a) {
        double r558344 = x;
        double r558345 = y;
        double r558346 = r558344 * r558345;
        double r558347 = z;
        double r558348 = t;
        double r558349 = r558347 * r558348;
        double r558350 = -r558349;
        double r558351 = r558346 + r558350;
        double r558352 = a;
        double r558353 = r558351 / r558352;
        return r558353;
}

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.3
Target5.7
Herbie7.3
\[\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.3

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

    \[\leadsto \frac{\color{blue}{x \cdot y + \left(-z \cdot t\right)}}{a}\]
  4. Final simplification7.3

    \[\leadsto \frac{x \cdot y + \left(-z \cdot t\right)}{a}\]

Reproduce

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