x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 9.14241781620673 \cdot 10^{+304}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 9.14241781620673e+304)))
(+ x (* (- z x) (/ y t)))
t_1)))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 t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 9.14241781620673e+304)) {
tmp = x + ((z - x) * (y / t));
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.0 |
| Herbie | 0.6 |
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 9.14241781620672955e304 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 61.6
Simplified1.6
Taylor expanded in y around 0 61.6
Simplified0.3
Applied fma-udef_binary640.3
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 9.14241781620672955e304Initial program 0.7
Final simplification0.6
herbie shell --seed 2022081
(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)))