Average Error: 1.2 → 1.2
Time: 15.8s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[x + y \cdot \left(\frac{z}{a - t} - \frac{t}{a - t}\right)\]
x + y \cdot \frac{z - t}{a - t}
x + y \cdot \left(\frac{z}{a - t} - \frac{t}{a - t}\right)
double f(double x, double y, double z, double t, double a) {
        double r530932 = x;
        double r530933 = y;
        double r530934 = z;
        double r530935 = t;
        double r530936 = r530934 - r530935;
        double r530937 = a;
        double r530938 = r530937 - r530935;
        double r530939 = r530936 / r530938;
        double r530940 = r530933 * r530939;
        double r530941 = r530932 + r530940;
        return r530941;
}

double f(double x, double y, double z, double t, double a) {
        double r530942 = x;
        double r530943 = y;
        double r530944 = z;
        double r530945 = a;
        double r530946 = t;
        double r530947 = r530945 - r530946;
        double r530948 = r530944 / r530947;
        double r530949 = r530946 / r530947;
        double r530950 = r530948 - r530949;
        double r530951 = r530943 * r530950;
        double r530952 = r530942 + r530951;
        return r530952;
}

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.2
Target0.4
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;y \lt -8.50808486055124107 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \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.2

    \[x + y \cdot \frac{z - t}{a - t}\]
  2. Using strategy rm
  3. Applied div-sub1.2

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

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

Reproduce

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

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

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