Average Error: 7.9 → 7.9
Time: 14.4s
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 r34032069 = x;
        double r34032070 = y;
        double r34032071 = r34032069 * r34032070;
        double r34032072 = z;
        double r34032073 = t;
        double r34032074 = r34032072 * r34032073;
        double r34032075 = r34032071 - r34032074;
        double r34032076 = a;
        double r34032077 = r34032075 / r34032076;
        return r34032077;
}

double f(double x, double y, double z, double t, double a) {
        double r34032078 = x;
        double r34032079 = y;
        double r34032080 = r34032078 * r34032079;
        double r34032081 = t;
        double r34032082 = z;
        double r34032083 = r34032081 * r34032082;
        double r34032084 = r34032080 - r34032083;
        double r34032085 = a;
        double r34032086 = r34032084 / r34032085;
        return r34032086;
}

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 +o rules:numerics
(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))