Average Error: 10.8 → 1.2
Time: 4.2s
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 r487937 = x;
        double r487938 = y;
        double r487939 = z;
        double r487940 = t;
        double r487941 = r487939 - r487940;
        double r487942 = r487938 * r487941;
        double r487943 = a;
        double r487944 = r487943 - r487940;
        double r487945 = r487942 / r487944;
        double r487946 = r487937 + r487945;
        return r487946;
}

double f(double x, double y, double z, double t, double a) {
        double r487947 = z;
        double r487948 = t;
        double r487949 = r487947 - r487948;
        double r487950 = a;
        double r487951 = r487950 - r487948;
        double r487952 = r487949 / r487951;
        double r487953 = y;
        double r487954 = r487952 * r487953;
        double r487955 = x;
        double r487956 = r487954 + r487955;
        return r487956;
}

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.8
Target1.1
Herbie1.2
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Initial program 10.8

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

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

    \[\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 2020035 +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))))