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:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -9.953171815688175 \cdot 10^{+90}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq 2.409171427171004 \cdot 10^{-205}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq 2.6526473394478125 \cdot 10^{+269}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (<= (+ x (/ (* y (- z x)) t)) (- INFINITY))
(+ x (* (- z x) (/ y t)))
(if (<= (+ x (/ (* y (- z x)) t)) -9.953171815688175e+90)
(+ x (/ (* y (- z x)) t))
(if (<= (+ x (/ (* y (- z x)) t)) 2.409171427171004e-205)
(+ x (/ y (/ t (- z x))))
(if (<= (+ x (/ (* y (- z x)) t)) 2.6526473394478125e+269)
(+ x (/ (* y (- z x)) t))
(+ x (* (- z x) (/ y 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)) {
tmp = x + ((z - x) * (y / t));
} else if ((x + ((y * (z - x)) / t)) <= -9.953171815688175e+90) {
tmp = x + ((y * (z - x)) / t);
} else if ((x + ((y * (z - x)) / t)) <= 2.409171427171004e-205) {
tmp = x + (y / (t / (z - x)));
} else if ((x + ((y * (z - x)) / t)) <= 2.6526473394478125e+269) {
tmp = x + ((y * (z - x)) / t);
} else {
tmp = x + ((z - x) * (y / t));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 1.8 |
| Herbie | 0.9 |
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 2.6526473394478125e269 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 45.8
rmApplied add-cube-cbrt_binary64_887146.0
Applied times-frac_binary64_88455.3
rmApplied pow1_binary64_88975.3
Applied pow1_binary64_88975.3
Applied pow-prod-down_binary64_89075.3
Simplified1.9
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -9.953171815688175e90 or 2.4091714271710038e-205 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.6526473394478125e269Initial program 0.3
if -9.953171815688175e90 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.4091714271710038e-205Initial program 2.1
rmApplied associate-/l*_binary64_87861.7
Final simplification0.9
herbie shell --seed 2020292
(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)))