Average Error: 1.5 → 1.3
Time: 25.1s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\frac{y}{\frac{a - t}{z - t}} + x\]
x + y \cdot \frac{z - t}{a - t}
\frac{y}{\frac{a - t}{z - t}} + x
double f(double x, double y, double z, double t, double a) {
        double r35299374 = x;
        double r35299375 = y;
        double r35299376 = z;
        double r35299377 = t;
        double r35299378 = r35299376 - r35299377;
        double r35299379 = a;
        double r35299380 = r35299379 - r35299377;
        double r35299381 = r35299378 / r35299380;
        double r35299382 = r35299375 * r35299381;
        double r35299383 = r35299374 + r35299382;
        return r35299383;
}

double f(double x, double y, double z, double t, double a) {
        double r35299384 = y;
        double r35299385 = a;
        double r35299386 = t;
        double r35299387 = r35299385 - r35299386;
        double r35299388 = z;
        double r35299389 = r35299388 - r35299386;
        double r35299390 = r35299387 / r35299389;
        double r35299391 = r35299384 / r35299390;
        double r35299392 = x;
        double r35299393 = r35299391 + r35299392;
        return r35299393;
}

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

Original1.5
Target0.4
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;y \lt -8.508084860551241069024247453646278348229 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Initial program 1.5

    \[x + y \cdot \frac{z - t}{a - t}\]
  2. Simplified1.5

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{z - t}} \cdot y + x}\]
  7. Simplified1.3

    \[\leadsto \color{blue}{\frac{y}{\frac{a - t}{z - t}}} + x\]
  8. Final simplification1.3

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

Reproduce

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

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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