Average Error: 10.5 → 1.2
Time: 21.2s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[t \cdot \frac{y - z}{a - z} + x\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
t \cdot \frac{y - z}{a - z} + x
double f(double x, double y, double z, double t, double a) {
        double r24314744 = x;
        double r24314745 = y;
        double r24314746 = z;
        double r24314747 = r24314745 - r24314746;
        double r24314748 = t;
        double r24314749 = r24314747 * r24314748;
        double r24314750 = a;
        double r24314751 = r24314750 - r24314746;
        double r24314752 = r24314749 / r24314751;
        double r24314753 = r24314744 + r24314752;
        return r24314753;
}

double f(double x, double y, double z, double t, double a) {
        double r24314754 = t;
        double r24314755 = y;
        double r24314756 = z;
        double r24314757 = r24314755 - r24314756;
        double r24314758 = a;
        double r24314759 = r24314758 - r24314756;
        double r24314760 = r24314757 / r24314759;
        double r24314761 = r24314754 * r24314760;
        double r24314762 = x;
        double r24314763 = r24314761 + r24314762;
        return r24314763;
}

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.5
Target0.6
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;t \lt -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.9110949887586375 \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 10.5

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

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

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

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

Reproduce

herbie shell --seed 2019168 +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))))