\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -3.1422801519322542 \cdot 10^{85} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.10620055177297528 \cdot 10^{-72} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 7.1035923095445766 \cdot 10^{280}\right)\right)\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\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 * (y + z)) / z) <= -inf.0) || !((((x * (y + z)) / z) <= -3.142280151932254e+85) || !((((x * (y + z)) / z) <= 1.1062005517729753e-72) || !(((x * (y + z)) / z) <= 7.103592309544577e+280))))) {
VAR = fma((y / z), x, x);
} else {
VAR = ((x * (y + z)) / z);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 3.1 |
| Herbie | 0.5 |
if (/ (* x (+ y z)) z) < -inf.0 or -3.142280151932254e+85 < (/ (* x (+ y z)) z) < 1.1062005517729753e-72 or 7.103592309544577e+280 < (/ (* x (+ y z)) z) Initial program 20.2
Simplified0.7
if -inf.0 < (/ (* x (+ y z)) z) < -3.142280151932254e+85 or 1.1062005517729753e-72 < (/ (* x (+ y z)) z) < 7.103592309544577e+280Initial program 0.3
Final simplification0.5
herbie shell --seed 2020071 +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))