Average Error: 6.2 → 1.3
Time: 4.3s
Precision: binary64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \leq 2.0589590708551167 \cdot 10^{-273}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 81861938587478.94:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z \cdot \frac{1}{\sqrt{t}}\right) \cdot \frac{y - x}{\sqrt{t}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;t \leq 2.0589590708551167 \cdot 10^{-273}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

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

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= t 2.0589590708551167e-273)
   (+ x (/ (- y x) (/ t z)))
   (if (<= t 81861938587478.94)
     (+ x (/ (* (- y x) z) t))
     (+ x (* (* z (/ 1.0 (sqrt t))) (/ (- y x) (sqrt t)))))))
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 tmp;
	if (t <= 2.0589590708551167e-273) {
		tmp = x + ((y - x) / (t / z));
	} else if (t <= 81861938587478.94) {
		tmp = x + (((y - x) * z) / t);
	} else {
		tmp = x + ((z * (1.0 / sqrt(t))) * ((y - x) / sqrt(t)));
	}
	return tmp;
}

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.2
Target2.0
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x < 4.275032163700715 \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 3 regimes
  2. if t < 2.05895907085511667e-273

    1. Initial program 5.9

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

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

    if 2.05895907085511667e-273 < t < 81861938587478.938

    1. Initial program 1.1

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

    if 81861938587478.938 < t

    1. Initial program 9.9

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Taylor expanded around 0 9.9

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

      \[\leadsto x + \color{blue}{z \cdot \frac{y - x}{t}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt_binary641.2

      \[\leadsto x + z \cdot \frac{y - x}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}\]
    6. Applied *-un-lft-identity_binary641.2

      \[\leadsto x + z \cdot \frac{\color{blue}{1 \cdot \left(y - x\right)}}{\sqrt{t} \cdot \sqrt{t}}\]
    7. Applied times-frac_binary641.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 2.0589590708551167 \cdot 10^{-273}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 81861938587478.94:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z \cdot \frac{1}{\sqrt{t}}\right) \cdot \frac{y - x}{\sqrt{t}}\\ \end{array}\]

Alternatives

Reproduce

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