x + \frac{y \cdot \left(z - t\right)}{a}\begin{array}{l}
\mathbf{if}\;a \le -1.96605357789947992 \cdot 10^{-23}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a} + x\\
\mathbf{elif}\;a \le 1.23690458140457419 \cdot 10^{-16}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{a} + x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\end{array}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 temp;
if ((a <= -1.96605357789948e-23)) {
temp = (((z - t) * (y / a)) + x);
} else {
double temp_1;
if ((a <= 1.2369045814045742e-16)) {
temp_1 = ((((z - t) * y) / a) + x);
} else {
temp_1 = (1.0 * fma(((z - t) / a), y, x));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 6.4 |
|---|---|
| Target | 0.7 |
| Herbie | 1.1 |
if a < -1.96605357789948e-23Initial program 9.3
Simplified1.9
rmApplied fma-udef1.9
rmApplied *-commutative1.9
if -1.96605357789948e-23 < a < 1.2369045814045742e-16Initial program 0.9
Simplified3.7
rmApplied fma-udef3.7
Taylor expanded around 0 0.9
Simplified0.9
if 1.2369045814045742e-16 < a Initial program 9.4
Simplified1.6
rmApplied fma-udef1.6
Taylor expanded around 0 9.4
Simplified9.4
rmApplied *-un-lft-identity9.4
Applied *-un-lft-identity9.4
Applied distribute-lft-out9.4
Simplified0.5
Final simplification1.1
herbie shell --seed 2020060 +o rules:numerics
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))