Average Error: 2.0 → 1.4
Time: 2.2s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \le -3.2874631937566708 \cdot 10^{283}:\\ \;\;\;\;x + \frac{-z}{\frac{-t}{y - x}}\\ \mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le -1.39263769542628016 \cdot 10^{-44}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 7.1363608524893538 \cdot 10^{-77}:\\ \;\;\;\;x + \frac{y - x}{-t} \cdot \left(-z\right)\\ \mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 4.2975414802270641 \cdot 10^{296}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right)\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \le -3.2874631937566708 \cdot 10^{283}:\\
\;\;\;\;x + \frac{-z}{\frac{-t}{y - x}}\\

\mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le -1.39263769542628016 \cdot 10^{-44}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

\mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 7.1363608524893538 \cdot 10^{-77}:\\
\;\;\;\;x + \frac{y - x}{-t} \cdot \left(-z\right)\\

\mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 4.2975414802270641 \cdot 10^{296}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return (x + ((y - x) * (z / t)));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((x + ((y - x) * (z / t))) <= -3.287463193756671e+283)) {
		VAR = (x + (-z / (-t / (y - x))));
	} else {
		double VAR_1;
		if (((x + ((y - x) * (z / t))) <= -1.3926376954262802e-44)) {
			VAR_1 = (x + ((y - x) * (z / t)));
		} else {
			double VAR_2;
			if (((x + ((y - x) * (z / t))) <= 7.136360852489354e-77)) {
				VAR_2 = (x + (((y - x) / -t) * -z));
			} else {
				double VAR_3;
				if (((x + ((y - x) * (z / t))) <= 4.297541480227064e+296)) {
					VAR_3 = (x + ((y - x) * (z / t)));
				} else {
					VAR_3 = (x + (((z * y) / t) - ((x * z) / t)));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.4
\[\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 4 regimes
  2. if (+ x (* (- y x) (/ z t))) < -3.287463193756671e+283

    1. Initial program 17.6

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

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\frac{1}{\frac{t}{z}}}\]
    4. Applied un-div-inv15.0

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    5. Using strategy rm
    6. Applied frac-2neg15.0

      \[\leadsto x + \frac{y - x}{\color{blue}{\frac{-t}{-z}}}\]
    7. Applied associate-/r/12.7

      \[\leadsto x + \color{blue}{\frac{y - x}{-t} \cdot \left(-z\right)}\]
    8. Using strategy rm
    9. Applied clear-num12.7

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

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

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

    if -3.287463193756671e+283 < (+ x (* (- y x) (/ z t))) < -1.3926376954262802e-44 or 7.136360852489354e-77 < (+ x (* (- y x) (/ z t))) < 4.297541480227064e+296

    1. Initial program 0.1

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

    if -1.3926376954262802e-44 < (+ x (* (- y x) (/ z t))) < 7.136360852489354e-77

    1. Initial program 2.7

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

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\frac{1}{\frac{t}{z}}}\]
    4. Applied un-div-inv3.0

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    5. Using strategy rm
    6. Applied frac-2neg3.0

      \[\leadsto x + \frac{y - x}{\color{blue}{\frac{-t}{-z}}}\]
    7. Applied associate-/r/2.6

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

    if 4.297541480227064e+296 < (+ x (* (- y x) (/ z t)))

    1. Initial program 27.8

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

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\frac{1}{\frac{t}{z}}}\]
    4. Applied un-div-inv24.0

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    5. Using strategy rm
    6. Applied frac-2neg24.0

      \[\leadsto x + \frac{y - x}{\color{blue}{\frac{-t}{-z}}}\]
    7. Applied associate-/r/10.8

      \[\leadsto x + \color{blue}{\frac{y - x}{-t} \cdot \left(-z\right)}\]
    8. Using strategy rm
    9. Applied clear-num10.9

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

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

      \[\leadsto x + \frac{\color{blue}{-z}}{\frac{-t}{y - x}}\]
    12. Taylor expanded around 0 10.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \le -3.2874631937566708 \cdot 10^{283}:\\ \;\;\;\;x + \frac{-z}{\frac{-t}{y - x}}\\ \mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le -1.39263769542628016 \cdot 10^{-44}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 7.1363608524893538 \cdot 10^{-77}:\\ \;\;\;\;x + \frac{y - x}{-t} \cdot \left(-z\right)\\ \mathbf{elif}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 4.2975414802270641 \cdot 10^{296}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right)\\ \end{array}\]

Reproduce

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