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;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.2 |
|---|---|
| Target | 2.0 |
| Herbie | 1.3 |
if t < 2.05895907085511667e-273Initial program 5.9
rmApplied associate-/l*_binary641.8
if 2.05895907085511667e-273 < t < 81861938587478.938Initial program 1.1
if 81861938587478.938 < t Initial program 9.9
Taylor expanded around 0 9.9
Simplified1.1
rmApplied add-sqr-sqrt_binary641.2
Applied *-un-lft-identity_binary641.2
Applied times-frac_binary641.2
Applied associate-*r*_binary640.6
Final simplification1.3
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)))