Average Error: 2.0 → 6.5
Time: 7.0s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
x + \left(y - x\right) \cdot \frac{z}{t}
x + \frac{\left(y - x\right) \cdot z}{t}
double f(double x, double y, double z, double t) {
        double r327313 = x;
        double r327314 = y;
        double r327315 = r327314 - r327313;
        double r327316 = z;
        double r327317 = t;
        double r327318 = r327316 / r327317;
        double r327319 = r327315 * r327318;
        double r327320 = r327313 + r327319;
        return r327320;
}

double f(double x, double y, double z, double t) {
        double r327321 = x;
        double r327322 = y;
        double r327323 = r327322 - r327321;
        double r327324 = z;
        double r327325 = r327323 * r327324;
        double r327326 = t;
        double r327327 = r327325 / r327326;
        double r327328 = r327321 + r327327;
        return r327328;
}

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.1
Herbie6.5
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.88671875:\\ \;\;\;\;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. Split input into 2 regimes
  2. if x < -5.554823316875535e-17 or 4.07875646090157e-273 < x

    1. Initial program 1.1

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

    if -5.554823316875535e-17 < x < 4.07875646090157e-273

    1. Initial program 4.0

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Using strategy rm
    3. Applied associate-*r/5.2

      \[\leadsto x + \color{blue}{\frac{\left(y - x\right) \cdot z}{t}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification6.5

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

Reproduce

herbie shell --seed 2019304 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
  :precision binary64

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.887) (+ 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))))