Average Error: 7.4 → 7.4
Time: 3.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\frac{x \cdot y - z \cdot t}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\frac{x \cdot y - z \cdot t}{a}
double f(double x, double y, double z, double t, double a) {
        double r801655 = x;
        double r801656 = y;
        double r801657 = r801655 * r801656;
        double r801658 = z;
        double r801659 = t;
        double r801660 = r801658 * r801659;
        double r801661 = r801657 - r801660;
        double r801662 = a;
        double r801663 = r801661 / r801662;
        return r801663;
}

double f(double x, double y, double z, double t, double a) {
        double r801664 = x;
        double r801665 = y;
        double r801666 = r801664 * r801665;
        double r801667 = z;
        double r801668 = t;
        double r801669 = r801667 * r801668;
        double r801670 = r801666 - r801669;
        double r801671 = a;
        double r801672 = r801670 / r801671;
        return r801672;
}

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.4
Target5.8
Herbie7.4
\[\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.4

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

    \[\leadsto \color{blue}{\frac{1}{\frac{a}{x \cdot y - z \cdot t}}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity7.7

    \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(x \cdot y - z \cdot t\right)}}}\]
  6. Applied *-un-lft-identity7.7

    \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot a}}{1 \cdot \left(x \cdot y - z \cdot t\right)}}\]
  7. Applied times-frac7.7

    \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{x \cdot y - z \cdot t}}}\]
  8. Applied add-cube-cbrt7.7

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{a}{x \cdot y - z \cdot t}}\]
  9. Applied times-frac7.7

    \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{a}{x \cdot y - z \cdot t}}}\]
  10. Simplified7.7

    \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{x \cdot y - z \cdot t}}\]
  11. Simplified7.4

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

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

Reproduce

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