Average Error: 2.0 → 2.0
Time: 22.9s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\frac{y - x}{\frac{t}{z}} + x\]
x + \left(y - x\right) \cdot \frac{z}{t}
\frac{y - x}{\frac{t}{z}} + x
double f(double x, double y, double z, double t) {
        double r377056 = x;
        double r377057 = y;
        double r377058 = r377057 - r377056;
        double r377059 = z;
        double r377060 = t;
        double r377061 = r377059 / r377060;
        double r377062 = r377058 * r377061;
        double r377063 = r377056 + r377062;
        return r377063;
}

double f(double x, double y, double z, double t) {
        double r377064 = y;
        double r377065 = x;
        double r377066 = r377064 - r377065;
        double r377067 = t;
        double r377068 = z;
        double r377069 = r377067 / r377068;
        double r377070 = r377066 / r377069;
        double r377071 = r377070 + r377065;
        return r377071;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target2.3
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.887:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} \lt -0.0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Initial program 2.0

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

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

    \[\leadsto \color{blue}{\left(y - x\right) \cdot \frac{z}{t} + x}\]
  5. Simplified2.0

    \[\leadsto \color{blue}{\frac{y - x}{\frac{t}{z}}} + x\]
  6. Final simplification2.0

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

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) -0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

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