Average Error: 8.0 → 8.0
Time: 4.1s
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 r849830 = x;
        double r849831 = y;
        double r849832 = r849830 * r849831;
        double r849833 = z;
        double r849834 = t;
        double r849835 = r849833 * r849834;
        double r849836 = r849832 - r849835;
        double r849837 = a;
        double r849838 = r849836 / r849837;
        return r849838;
}

double f(double x, double y, double z, double t, double a) {
        double r849839 = x;
        double r849840 = y;
        double r849841 = r849839 * r849840;
        double r849842 = a;
        double r849843 = r849841 / r849842;
        double r849844 = t;
        double r849845 = z;
        double r849846 = r849844 * r849845;
        double r849847 = r849846 / r849842;
        double r849848 = r849843 - r849847;
        return r849848;
}

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

Original8.0
Target6.2
Herbie8.0
\[\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 8.0

    \[\frac{x \cdot y - z \cdot t}{a}\]
  2. Using strategy rm
  3. Applied div-inv8.1

    \[\leadsto \color{blue}{\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}}\]
  4. Using strategy rm
  5. Applied add-cube-cbrt8.9

    \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x \cdot y - z \cdot t} \cdot \sqrt[3]{x \cdot y - z \cdot t}\right) \cdot \sqrt[3]{x \cdot y - z \cdot t}\right)} \cdot \frac{1}{a}\]
  6. Taylor expanded around 0 8.0

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

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

Reproduce

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

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