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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.4 |
|---|---|
| Target | 1.9 |
| Herbie | 2.1 |
if t < -1.65040171643327031e82Initial program 11.3
rmApplied associate-/l*_binary641.5
rmApplied div-sub_binary641.5
Applied associate-+r-_binary641.5
rmApplied div-inv_binary641.5
Simplified1.5
if -1.65040171643327031e82 < t < 4.6167735875353816e-91Initial program 2.6
rmApplied div-inv_binary642.7
if 4.6167735875353816e-91 < t Initial program 7.3
rmApplied associate-/l*_binary641.2
rmApplied div-inv_binary641.2
Applied associate-/r*_binary641.9
Final simplification2.1
herbie shell --seed 2020219
(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)))