Average Error: 7.9 → 7.9
Time: 18.3s
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 r60518974 = x;
        double r60518975 = y;
        double r60518976 = r60518974 * r60518975;
        double r60518977 = z;
        double r60518978 = t;
        double r60518979 = r60518977 * r60518978;
        double r60518980 = r60518976 - r60518979;
        double r60518981 = a;
        double r60518982 = r60518980 / r60518981;
        return r60518982;
}

double f(double x, double y, double z, double t, double a) {
        double r60518983 = x;
        double r60518984 = y;
        double r60518985 = r60518983 * r60518984;
        double r60518986 = t;
        double r60518987 = z;
        double r60518988 = r60518986 * r60518987;
        double r60518989 = r60518985 - r60518988;
        double r60518990 = a;
        double r60518991 = r60518989 / r60518990;
        return r60518991;
}

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))