Average Error: 7.6 → 7.7
Time: 3.4s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}
double f(double x, double y, double z, double t, double a) {
        double r899084 = x;
        double r899085 = y;
        double r899086 = r899084 * r899085;
        double r899087 = z;
        double r899088 = t;
        double r899089 = r899087 * r899088;
        double r899090 = r899086 - r899089;
        double r899091 = a;
        double r899092 = r899090 / r899091;
        return r899092;
}

double f(double x, double y, double z, double t, double a) {
        double r899093 = x;
        double r899094 = y;
        double r899095 = r899093 * r899094;
        double r899096 = z;
        double r899097 = t;
        double r899098 = r899096 * r899097;
        double r899099 = r899095 - r899098;
        double r899100 = 1.0;
        double r899101 = a;
        double r899102 = r899100 / r899101;
        double r899103 = r899099 * r899102;
        return r899103;
}

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
Target5.9
Herbie7.7
\[\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.6

    \[\frac{x \cdot y - z \cdot t}{a}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity7.6

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

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

    \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{x \cdot y - z \cdot t}{a}}\]
  6. Simplified7.6

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

    \[\leadsto 1 \cdot \color{blue}{\left(\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\right)}\]
  9. Final simplification7.7

    \[\leadsto \left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\]

Reproduce

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