Average Error: 7.6 → 7.7
Time: 3.2s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}
double f(double x, double y, double z, double t, double a) {
        double r1018986 = x;
        double r1018987 = y;
        double r1018988 = r1018986 * r1018987;
        double r1018989 = z;
        double r1018990 = t;
        double r1018991 = r1018989 * r1018990;
        double r1018992 = r1018988 - r1018991;
        double r1018993 = a;
        double r1018994 = r1018992 / r1018993;
        return r1018994;
}

double f(double x, double y, double z, double t, double a) {
        double r1018995 = x;
        double r1018996 = y;
        double r1018997 = r1018995 * r1018996;
        double r1018998 = z;
        double r1018999 = t;
        double r1019000 = r1018998 * r1018999;
        double r1019001 = r1018997 - r1019000;
        double r1019002 = 1.0;
        double r1019003 = a;
        double r1019004 = r1019002 / r1019003;
        double r1019005 = r1019001 * r1019004;
        return r1019005;
}

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.7
\[\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 div-inv7.7

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

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

Reproduce

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