\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.5037721768491619 \cdot 10^{-102} \lor \neg \left(z \le -4.15245894315525662 \cdot 10^{-198}\right):\\
\;\;\;\;\frac{y}{z} \cdot x + x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z} + x\\
\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 (((z <= -3.503772176849162e-102) || !(z <= -4.1524589431552566e-198))) {
VAR = (((y / z) * x) + x);
} else {
VAR = ((y * (x / z)) + x);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 2.9 |
| Herbie | 3.0 |
if z < -3.503772176849162e-102 or -4.1524589431552566e-198 < z Initial program 12.6
Simplified2.7
rmApplied fma-udef2.7
if -3.503772176849162e-102 < z < -4.1524589431552566e-198Initial program 7.8
Simplified8.9
rmApplied fma-udef8.9
rmApplied div-inv8.9
Applied associate-*l*7.6
Simplified7.5
Final simplification3.0
herbie shell --seed 2020079 +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))