x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -8.937818910510886 \cdot 10^{+265}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)\\
\mathbf{elif}\;t_1 \leq 1.0387296294903554 \cdot 10^{+170}:\\
\;\;\;\;\left(x + \frac{y \cdot t}{a}\right) - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(t - z\right) \cdot \frac{1}{a}, x\right)\\
\end{array}
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (<= t_1 -8.937818910510886e+265)
(fma (/ y a) (- t z) x)
(if (<= t_1 1.0387296294903554e+170)
(- (+ x (/ (* y t) a)) (/ (* y z) a))
(fma y (* (- t z) (/ 1.0 a)) x)))))double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -8.937818910510886e+265) {
tmp = fma((y / a), (t - z), x);
} else if (t_1 <= 1.0387296294903554e+170) {
tmp = (x + ((y * t) / a)) - ((y * z) / a);
} else {
tmp = fma(y, ((t - z) * (1.0 / a)), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 6.2 |
|---|---|
| Target | 0.7 |
| Herbie | 0.5 |
if (*.f64 y (-.f64 z t)) < -8.9378189105108861e265Initial program 45.5
Simplified0.2
Taylor expanded in y around 0 45.5
Simplified0.4
if -8.9378189105108861e265 < (*.f64 y (-.f64 z t)) < 1.03872962949035538e170Initial program 0.4
Simplified7.2
Taylor expanded in y around 0 0.4
if 1.03872962949035538e170 < (*.f64 y (-.f64 z t)) Initial program 23.9
Simplified1.3
Applied div-inv_binary641.4
Final simplification0.5
herbie shell --seed 2022125
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (- x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))
(- x (/ (* y (- z t)) a)))