Average Error: 6.3 → 2.2
Time: 1.9s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -2.3190062364282818 \cdot 10^{87} \lor \neg \left(t \le -7.1064035504258002 \cdot 10^{-228}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{-t}{\left(y - x\right) \cdot \left(-z\right)}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;t \le -2.3190062364282818 \cdot 10^{87} \lor \neg \left(t \le -7.1064035504258002 \cdot 10^{-228}\right):\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{-t}{\left(y - x\right) \cdot \left(-z\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 (((t <= -2.319006236428282e+87) || !(t <= -7.1064035504258e-228))) {
		VAR = (x + ((y - x) * (z / t)));
	} else {
		VAR = (x + (1.0 / (-t / ((y - x) * -z))));
	}
	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

Original6.3
Target2.1
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;x \lt -9.0255111955330046 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.2750321637007147 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -2.319006236428282e+87 or -7.1064035504258e-228 < t

    1. Initial program 7.5

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv2.3

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

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

    if -2.319006236428282e+87 < t < -7.1064035504258e-228

    1. Initial program 2.0

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied clear-num2.1

      \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{t}{z}}{y - x}}}\]
    6. Using strategy rm
    7. Applied frac-2neg2.1

      \[\leadsto x + \frac{1}{\frac{\color{blue}{\frac{-t}{-z}}}{y - x}}\]
    8. Applied associate-/l/2.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.3190062364282818 \cdot 10^{87} \lor \neg \left(t \le -7.1064035504258002 \cdot 10^{-228}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{-t}{\left(y - x\right) \cdot \left(-z\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020071 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

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