Average Error: 9.9 → 1.2
Time: 9.8s
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 r9400955 = x;
        double r9400956 = y;
        double r9400957 = z;
        double r9400958 = t;
        double r9400959 = r9400957 - r9400958;
        double r9400960 = r9400956 * r9400959;
        double r9400961 = a;
        double r9400962 = r9400961 - r9400958;
        double r9400963 = r9400960 / r9400962;
        double r9400964 = r9400955 + r9400963;
        return r9400964;
}

double f(double x, double y, double z, double t, double a) {
        double r9400965 = z;
        double r9400966 = t;
        double r9400967 = r9400965 - r9400966;
        double r9400968 = a;
        double r9400969 = r9400968 - r9400966;
        double r9400970 = r9400967 / r9400969;
        double r9400971 = y;
        double r9400972 = r9400970 * r9400971;
        double r9400973 = x;
        double r9400974 = r9400972 + r9400973;
        return r9400974;
}

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

Original9.9
Target1.2
Herbie1.2
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Initial program 9.9

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

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

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

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

    \[\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 2019156 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"

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

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