x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_1 \leq 1.7047806052311535 \cdot 10^{-214}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
\mathbf{elif}\;t_1 \leq 4.139611946340411 \cdot 10^{+303}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) z) t))))
(if (<= t_1 1.7047806052311535e-214)
(fma (- y x) (/ z t) x)
(if (<= t_1 4.139611946340411e+303) t_1 (+ x (/ (- y x) (/ t z)))))))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 t_1 = x + (((y - x) * z) / t);
double tmp;
if (t_1 <= 1.7047806052311535e-214) {
tmp = fma((y - x), (z / t), x);
} else if (t_1 <= 4.139611946340411e+303) {
tmp = t_1;
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.4 |
|---|---|
| Target | 2.1 |
| Herbie | 1.3 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.70478060523115349e-214Initial program 6.4
Simplified2.0
if 1.70478060523115349e-214 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 4.1396119463404107e303Initial program 0.4
if 4.1396119463404107e303 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 60.3
Applied associate-/l*_binary640.5
Final simplification1.3
herbie shell --seed 2022067
(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)))