Average Error: 6.7 → 6.7
Time: 16.5s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\frac{x \cdot y}{a} - \frac{t \cdot z}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\frac{x \cdot y}{a} - \frac{t \cdot z}{a}
double f(double x, double y, double z, double t, double a) {
        double r41512072 = x;
        double r41512073 = y;
        double r41512074 = r41512072 * r41512073;
        double r41512075 = z;
        double r41512076 = t;
        double r41512077 = r41512075 * r41512076;
        double r41512078 = r41512074 - r41512077;
        double r41512079 = a;
        double r41512080 = r41512078 / r41512079;
        return r41512080;
}

double f(double x, double y, double z, double t, double a) {
        double r41512081 = x;
        double r41512082 = y;
        double r41512083 = r41512081 * r41512082;
        double r41512084 = a;
        double r41512085 = r41512083 / r41512084;
        double r41512086 = t;
        double r41512087 = z;
        double r41512088 = r41512086 * r41512087;
        double r41512089 = r41512088 / r41512084;
        double r41512090 = r41512085 - r41512089;
        return r41512090;
}

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

Original6.7
Target5.8
Herbie6.7
\[\begin{array}{l} \mathbf{if}\;z \lt -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.309831121978371 \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 6.7

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

    \[\leadsto \color{blue}{\frac{1}{\frac{a}{x \cdot y - z \cdot t}}}\]
  4. Using strategy rm
  5. Applied div-inv7.1

    \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{x \cdot y - z \cdot t}}}\]
  6. Applied associate-/r*6.9

    \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\frac{1}{x \cdot y - z \cdot t}}}\]
  7. Taylor expanded around inf 6.7

    \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{t \cdot z}{a}}\]
  8. Final simplification6.7

    \[\leadsto \frac{x \cdot y}{a} - \frac{t \cdot z}{a}\]

Reproduce

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