Average Error: 7.8 → 7.8
Time: 12.8s
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 r1175961 = x;
        double r1175962 = y;
        double r1175963 = r1175961 * r1175962;
        double r1175964 = z;
        double r1175965 = t;
        double r1175966 = r1175964 * r1175965;
        double r1175967 = r1175963 - r1175966;
        double r1175968 = a;
        double r1175969 = r1175967 / r1175968;
        return r1175969;
}

double f(double x, double y, double z, double t, double a) {
        double r1175970 = x;
        double r1175971 = y;
        double r1175972 = r1175970 * r1175971;
        double r1175973 = a;
        double r1175974 = r1175972 / r1175973;
        double r1175975 = t;
        double r1175976 = z;
        double r1175977 = r1175975 * r1175976;
        double r1175978 = r1175977 / r1175973;
        double r1175979 = r1175974 - r1175978;
        return r1175979;
}

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.8
Target6.2
Herbie7.8
\[\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.8

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

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

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

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

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

Reproduce

herbie shell --seed 2019209 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :herbie-target
  (if (< z -2.46868496869954822e170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.30983112197837121e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

  (/ (- (* x y) (* z t)) a))