Average Error: 2.0 → 1.3
Time: 4.0s
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 r515629 = x;
        double r515630 = y;
        double r515631 = r515630 - r515629;
        double r515632 = z;
        double r515633 = t;
        double r515634 = r515632 / r515633;
        double r515635 = r515631 * r515634;
        double r515636 = r515629 + r515635;
        return r515636;
}

double f(double x, double y, double z, double t) {
        double r515637 = z;
        double r515638 = t;
        double r515639 = r515637 / r515638;
        double r515640 = -2.143643766562678e+267;
        bool r515641 = r515639 <= r515640;
        double r515642 = x;
        double r515643 = y;
        double r515644 = r515643 - r515642;
        double r515645 = r515644 * r515637;
        double r515646 = 1.0;
        double r515647 = r515646 / r515638;
        double r515648 = r515645 * r515647;
        double r515649 = r515642 + r515648;
        double r515650 = r515644 * r515639;
        double r515651 = r515642 + r515650;
        double r515652 = r515641 ? r515649 : r515651;
        return r515652;
}

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))))