\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -1.38635864862267137 \cdot 10^{-72} \lor \neg \left(x \le 1.7087081133191823 \cdot 10^{-110}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}} + x\\
\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 VAR;
if (((x <= -1.3863586486226714e-72) || !(x <= 1.7087081133191823e-110))) {
VAR = ((x / (z / y)) + x);
} else {
VAR = fma((x / -z), -y, x);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 2.0 |
if x < -1.3863586486226714e-72 or 1.7087081133191823e-110 < x Initial program 16.3
Simplified0.9
rmApplied fma-udef0.9
rmApplied clear-num1.0
Applied associate-*l/0.8
Simplified0.8
if -1.3863586486226714e-72 < x < 1.7087081133191823e-110Initial program 6.8
Simplified6.6
rmApplied fma-udef6.7
rmApplied clear-num6.7
Applied associate-*l/6.2
Simplified6.2
rmApplied frac-2neg6.2
Applied associate-/r/3.6
Applied fma-def3.6
Final simplification2.0
herbie shell --seed 2020078 +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))