Average Error: 10.7 → 1.2
Time: 3.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\frac{z - t}{a - t} \cdot y + x\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\frac{z - t}{a - t} \cdot y + x
double f(double x, double y, double z, double t, double a) {
        double r554720 = x;
        double r554721 = y;
        double r554722 = z;
        double r554723 = t;
        double r554724 = r554722 - r554723;
        double r554725 = r554721 * r554724;
        double r554726 = a;
        double r554727 = r554726 - r554723;
        double r554728 = r554725 / r554727;
        double r554729 = r554720 + r554728;
        return r554729;
}

double f(double x, double y, double z, double t, double a) {
        double r554730 = z;
        double r554731 = t;
        double r554732 = r554730 - r554731;
        double r554733 = a;
        double r554734 = r554733 - r554731;
        double r554735 = r554732 / r554734;
        double r554736 = y;
        double r554737 = r554735 * r554736;
        double r554738 = x;
        double r554739 = r554737 + r554738;
        return r554739;
}

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

Original10.7
Target1.1
Herbie1.2
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Initial program 10.7

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y}} \cdot \left(z - t\right) + x}\]
  7. Simplified3.2

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

    \[\leadsto \color{blue}{\frac{z - t}{a - t} \cdot y} + x\]
  10. Final simplification1.2

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

Reproduce

herbie shell --seed 2020064 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- a t) (- z t))))

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