Average Error: 1.2 → 1.2
Time: 5.6s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\frac{1}{\frac{\frac{a - t}{z - t}}{y}} + x\]
x + y \cdot \frac{z - t}{a - t}
\frac{1}{\frac{\frac{a - t}{z - t}}{y}} + x
double f(double x, double y, double z, double t, double a) {
        double r527703 = x;
        double r527704 = y;
        double r527705 = z;
        double r527706 = t;
        double r527707 = r527705 - r527706;
        double r527708 = a;
        double r527709 = r527708 - r527706;
        double r527710 = r527707 / r527709;
        double r527711 = r527704 * r527710;
        double r527712 = r527703 + r527711;
        return r527712;
}

double f(double x, double y, double z, double t, double a) {
        double r527713 = 1.0;
        double r527714 = a;
        double r527715 = t;
        double r527716 = r527714 - r527715;
        double r527717 = z;
        double r527718 = r527717 - r527715;
        double r527719 = r527716 / r527718;
        double r527720 = y;
        double r527721 = r527719 / r527720;
        double r527722 = r527713 / r527721;
        double r527723 = x;
        double r527724 = r527722 + r527723;
        return r527724;
}

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.5
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.2

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

    \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{a - t}{z - t}}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity1.2

    \[\leadsto x + \color{blue}{\left(1 \cdot y\right)} \cdot \frac{1}{\frac{a - t}{z - t}}\]
  6. Applied associate-*l*1.2

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

    \[\leadsto x + 1 \cdot \color{blue}{\frac{y}{\frac{a - t}{z - t}}}\]
  8. Using strategy rm
  9. Applied clear-num1.2

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

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

Reproduce

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