Average Error: 1.3 → 1.2
Time: 23.8s
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 r387560 = x;
        double r387561 = y;
        double r387562 = z;
        double r387563 = t;
        double r387564 = r387562 - r387563;
        double r387565 = a;
        double r387566 = r387565 - r387563;
        double r387567 = r387564 / r387566;
        double r387568 = r387561 * r387567;
        double r387569 = r387560 + r387568;
        return r387569;
}

double f(double x, double y, double z, double t, double a) {
        double r387570 = y;
        double r387571 = a;
        double r387572 = t;
        double r387573 = r387571 - r387572;
        double r387574 = z;
        double r387575 = r387574 - r387572;
        double r387576 = r387573 / r387575;
        double r387577 = r387570 / r387576;
        double r387578 = x;
        double r387579 = r387577 + r387578;
        return r387579;
}

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

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

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

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

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

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

Reproduce

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