Average Error: 7.6 → 7.6
Time: 4.4s
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 r954485 = x;
        double r954486 = y;
        double r954487 = r954485 * r954486;
        double r954488 = z;
        double r954489 = t;
        double r954490 = r954488 * r954489;
        double r954491 = r954487 - r954490;
        double r954492 = a;
        double r954493 = r954491 / r954492;
        return r954493;
}

double f(double x, double y, double z, double t, double a) {
        double r954494 = x;
        double r954495 = y;
        double r954496 = r954494 * r954495;
        double r954497 = z;
        double r954498 = t;
        double r954499 = r954497 * r954498;
        double r954500 = -r954499;
        double r954501 = r954496 + r954500;
        double r954502 = a;
        double r954503 = r954501 / r954502;
        return r954503;
}

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

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

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

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

Reproduce

herbie shell --seed 2019353 +o rules:numerics
(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))