\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -2.161724350185571 \cdot 10^{-40} \lor \neg \left(x \le 1.1452918085668837 \cdot 10^{-153}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot \left(y + z\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 (((x <= -2.161724350185571e-40) || !(x <= 1.1452918085668837e-153))) {
temp = fma((y / z), x, x);
} else {
temp = (1.0 / (z / (x * (y + z))));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.0 |
|---|---|
| Target | 3.0 |
| Herbie | 3.1 |
if x < -2.161724350185571e-40 or 1.1452918085668837e-153 < x Initial program 15.9
Simplified1.1
if -2.161724350185571e-40 < x < 1.1452918085668837e-153Initial program 6.2
rmApplied clear-num6.3
Final simplification3.1
herbie shell --seed 2020057 +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))