Average Error: 10.4 → 1.3
Time: 20.6s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[x + \left(\frac{1}{a - z} \cdot \left(y - z\right)\right) \cdot t\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
x + \left(\frac{1}{a - z} \cdot \left(y - z\right)\right) \cdot t
double f(double x, double y, double z, double t, double a) {
        double r23203081 = x;
        double r23203082 = y;
        double r23203083 = z;
        double r23203084 = r23203082 - r23203083;
        double r23203085 = t;
        double r23203086 = r23203084 * r23203085;
        double r23203087 = a;
        double r23203088 = r23203087 - r23203083;
        double r23203089 = r23203086 / r23203088;
        double r23203090 = r23203081 + r23203089;
        return r23203090;
}

double f(double x, double y, double z, double t, double a) {
        double r23203091 = x;
        double r23203092 = 1.0;
        double r23203093 = a;
        double r23203094 = z;
        double r23203095 = r23203093 - r23203094;
        double r23203096 = r23203092 / r23203095;
        double r23203097 = y;
        double r23203098 = r23203097 - r23203094;
        double r23203099 = r23203096 * r23203098;
        double r23203100 = t;
        double r23203101 = r23203099 * r23203100;
        double r23203102 = r23203091 + r23203101;
        return r23203102;
}

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.4
Target0.5
Herbie1.3
\[\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 10.4

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{a - z}\right) \cdot t} + x\]
  11. Final simplification1.3

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

Reproduce

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