Average Error: 7.6 → 7.8
Time: 20.1s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\]
\frac{x \cdot y - z \cdot t}{a}
\frac{1}{\frac{a}{x \cdot y - z \cdot t}}
double f(double x, double y, double z, double t, double a) {
        double r591019 = x;
        double r591020 = y;
        double r591021 = r591019 * r591020;
        double r591022 = z;
        double r591023 = t;
        double r591024 = r591022 * r591023;
        double r591025 = r591021 - r591024;
        double r591026 = a;
        double r591027 = r591025 / r591026;
        return r591027;
}

double f(double x, double y, double z, double t, double a) {
        double r591028 = 1.0;
        double r591029 = a;
        double r591030 = x;
        double r591031 = y;
        double r591032 = r591030 * r591031;
        double r591033 = z;
        double r591034 = t;
        double r591035 = r591033 * r591034;
        double r591036 = r591032 - r591035;
        double r591037 = r591029 / r591036;
        double r591038 = r591028 / r591037;
        return r591038;
}

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
Target6.3
Herbie7.8
\[\begin{array}{l} \mathbf{if}\;z \lt -2.46868496869954822 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.30983112197837121 \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 clear-num7.8

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

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

Reproduce

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