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 -5.824773279485707 \cdot 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\mathbf{elif}\;t_1 \leq 6.756050800944467 \cdot 10^{+297}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\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 (<= t_1 -5.824773279485707e+304)
(fma (/ y t) (- z x) x)
(if (<= t_1 6.756050800944467e+297) t_1 (+ 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 t_1 = x + ((y * (z - x)) / t);
double tmp;
if (t_1 <= -5.824773279485707e+304) {
tmp = fma((y / t), (z - x), x);
} else if (t_1 <= 6.756050800944467e+297) {
tmp = t_1;
} 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
| Original | 6.5 |
|---|---|
| Target | 2.0 |
| Herbie | 1.0 |
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -5.82477327948570682e304Initial program 61.0
Simplified1.6
Taylor expanded in y around 0 61.0
Simplified0.8
if -5.82477327948570682e304 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 6.75605080094446744e297Initial program 0.7
if 6.75605080094446744e297 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 52.1
Simplified5.2
Applied fma-udef_binary645.2
Final simplification1.0
herbie shell --seed 2022063
(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)))