x + \frac{\left(y - x\right) \cdot z}{t}\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} \leq -6.238364551015496 \cdot 10^{+307}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \leq -1.696373183776563 \cdot 10^{-260}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{y}{\frac{t}{z}} - \frac{x}{\frac{t}{z}}\right)\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(if (<= (+ x (/ (* (- y x) z) t)) -6.238364551015496e+307)
(+ x (* z (/ (- y x) t)))
(if (<= (+ x (/ (* (- y x) z) t)) -1.696373183776563e-260)
(+ x (/ (* (- y x) z) t))
(+ x (- (/ y (/ t z)) (/ 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 tmp;
if ((x + (((y - x) * z) / t)) <= -6.238364551015496e+307) {
tmp = x + (z * ((y - x) / t));
} else if ((x + (((y - x) * z) / t)) <= -1.696373183776563e-260) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = x + ((y / (t / z)) - (x / (t / z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.5 |
|---|---|
| Target | 2.0 |
| Herbie | 1.3 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -6.23836455101549579e307Initial program 63.3
rmApplied associate-/l*_binary64_129810.5
rmApplied associate-/r/_binary64_129820.2
if -6.23836455101549579e307 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -1.69637318377656301e-260Initial program 0.6
if -1.69637318377656301e-260 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 6.4
rmApplied associate-/l*_binary64_129811.9
rmApplied div-sub_binary64_130411.9
Final simplification1.3
herbie shell --seed 2020355
(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)))