\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -9.04077640072219121 \cdot 10^{-80}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;z \le 1.18667300925519477 \cdot 10^{-299}:\\
\;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\end{array}double code(double x, double y, double z) {
return ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
double temp;
if ((z <= -9.040776400722191e-80)) {
temp = (x / (z / (y + z)));
} else {
double temp_1;
if ((z <= 1.1866730092551948e-299)) {
temp_1 = ((x * (y + z)) * (1.0 / z));
} else {
temp_1 = fma((x / z), y, x);
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.1 |
| Herbie | 3.9 |
if z < -9.040776400722191e-80Initial program 14.1
rmApplied associate-/l*0.3
if -9.040776400722191e-80 < z < 1.1866730092551948e-299Initial program 9.1
rmApplied div-inv9.2
if 1.1866730092551948e-299 < z Initial program 12.1
Taylor expanded around 0 4.7
Simplified4.7
Final simplification3.9
herbie shell --seed 2020066 +o rules:numerics
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))