Average Error: 11.1 → 1.4
Time: 18.5s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
double f(double x, double y, double z, double t, double a) {
        double r25093615 = x;
        double r25093616 = y;
        double r25093617 = z;
        double r25093618 = r25093616 - r25093617;
        double r25093619 = t;
        double r25093620 = r25093618 * r25093619;
        double r25093621 = a;
        double r25093622 = r25093621 - r25093617;
        double r25093623 = r25093620 / r25093622;
        double r25093624 = r25093615 + r25093623;
        return r25093624;
}

double f(double x, double y, double z, double t, double a) {
        double r25093625 = y;
        double r25093626 = z;
        double r25093627 = r25093625 - r25093626;
        double r25093628 = a;
        double r25093629 = r25093628 - r25093626;
        double r25093630 = r25093627 / r25093629;
        double r25093631 = t;
        double r25093632 = x;
        double r25093633 = fma(r25093630, r25093631, r25093632);
        return r25093633;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original11.1
Target0.6
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;t \lt -1.068297449017406694366747246993994850729 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.911094988758637497591020599238553861375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array}\]

Derivation

  1. Initial program 11.1

    \[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
  2. Simplified2.8

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)}\]
  3. Using strategy rm
  4. Applied clear-num3.0

    \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{\frac{1}{\frac{a - z}{t}}}, x\right)\]
  5. Using strategy rm
  6. Applied add-cube-cbrt3.5

    \[\leadsto \mathsf{fma}\left(y - z, \frac{1}{\color{blue}{\left(\sqrt[3]{\frac{a - z}{t}} \cdot \sqrt[3]{\frac{a - z}{t}}\right) \cdot \sqrt[3]{\frac{a - z}{t}}}}, x\right)\]
  7. Applied associate-/r*3.5

    \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{\frac{\frac{1}{\sqrt[3]{\frac{a - z}{t}} \cdot \sqrt[3]{\frac{a - z}{t}}}}{\sqrt[3]{\frac{a - z}{t}}}}, x\right)\]
  8. Using strategy rm
  9. Applied fma-udef3.5

    \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{\frac{1}{\sqrt[3]{\frac{a - z}{t}} \cdot \sqrt[3]{\frac{a - z}{t}}}}{\sqrt[3]{\frac{a - z}{t}}} + x}\]
  10. Simplified2.8

    \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t}}} + x\]
  11. Using strategy rm
  12. Applied associate-/r/1.4

    \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot t} + x\]
  13. Applied fma-def1.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)}\]
  14. Final simplification1.4

    \[\leadsto \mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)\]

Reproduce

herbie shell --seed 2019192 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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