Average Error: 2.0 → 1.3
Time: 4.3s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{z}{t} \le -2.143643766562678 \cdot 10^{267}:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \le -2.143643766562678 \cdot 10^{267}:\\
\;\;\;\;x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\\

\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r664402 = x;
        double r664403 = y;
        double r664404 = r664403 - r664402;
        double r664405 = z;
        double r664406 = t;
        double r664407 = r664405 / r664406;
        double r664408 = r664404 * r664407;
        double r664409 = r664402 + r664408;
        return r664409;
}

double f(double x, double y, double z, double t) {
        double r664410 = z;
        double r664411 = t;
        double r664412 = r664410 / r664411;
        double r664413 = -2.143643766562678e+267;
        bool r664414 = r664412 <= r664413;
        double r664415 = x;
        double r664416 = y;
        double r664417 = r664416 - r664415;
        double r664418 = r664417 * r664410;
        double r664419 = 1.0;
        double r664420 = r664419 / r664411;
        double r664421 = r664418 * r664420;
        double r664422 = r664415 + r664421;
        double r664423 = r664417 * r664412;
        double r664424 = r664415 + r664423;
        double r664425 = r664414 ? r664422 : r664424;
        return r664425;
}

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.2
Herbie1.3
\[\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. Split input into 2 regimes
  2. if (/ z t) < -2.143643766562678e+267

    1. Initial program 39.9

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Using strategy rm
    3. Applied div-inv39.9

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\left(z \cdot \frac{1}{t}\right)}\]
    4. Applied associate-*r*0.8

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

    if -2.143643766562678e+267 < (/ z t)

    1. Initial program 1.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{z}{t} \le -2.143643766562678 \cdot 10^{267}:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020062 
(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))))