x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 7.368615275434186 \cdot 10^{+270}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (or (<= (+ x (/ (* y (- z x)) t)) (- INFINITY))
(not (<= (+ x (/ (* y (- z x)) t)) 7.368615275434186e+270)))
(+ x (* (- z x) (/ y t)))
(+ x (/ (* y (- z x)) t))))double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
double code(double x, double y, double z, double t) {
double tmp;
if (((x + ((y * (z - x)) / t)) <= -((double) INFINITY)) || !((x + ((y * (z - x)) / t)) <= 7.368615275434186e+270)) {
tmp = x + ((z - x) * (y / t));
} else {
tmp = x + ((y * (z - x)) / t);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.4 |
|---|---|
| Target | 2.0 |
| Herbie | 0.9 |
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 7.3686152754341861e270 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 44.7
rmApplied add-cube-cbrt_binary6444.9
Applied times-frac_binary645.0
rmApplied pow1_binary645.0
Applied pow1_binary645.0
Applied pow-prod-down_binary645.0
Simplified1.7
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 7.3686152754341861e270Initial program 0.8
Final simplification0.9
herbie shell --seed 2020232
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))