x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \leq -1.060814198893335 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t) :precision binary64 (if (<= y -1.060814198893335e-33) (fma y (/ (- z x) t) x) (fma (/ y t) (- z x) x)))
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 (y <= -1.060814198893335e-33) {
tmp = fma(y, ((z - x) / t), x);
} else {
tmp = fma((y / t), (z - x), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.3 |
|---|---|
| Target | 2.1 |
| Herbie | 1.7 |
if y < -1.06081419889333503e-33Initial program 13.3
Simplified1.4
if -1.06081419889333503e-33 < y Initial program 4.3
Taylor expanded in x around 0 4.3
Simplified1.7
Final simplification1.7
herbie shell --seed 2021313
(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)))