\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 -1.24043934112551738 \cdot 10^{170} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 30542.5456077980816 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 7.426458603776121 \cdot 10^{296}\right)\right)\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (y + z)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((((double) (((double) (x * ((double) (y + z)))) / z)) <= -inf.0) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= -1.2404393411255174e+170) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= 30542.54560779808) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= 7.42645860377612e+296))))) {
VAR = ((double) (x / ((double) (z / ((double) (y + z))))));
} else {
VAR = ((double) (((double) (x * ((double) (y + z)))) / z));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 13.1 |
|---|---|
| Target | 2.7 |
| Herbie | 0.7 |
if (/ (* x (+ y z)) z) < -inf.0 or -1.2404393411255174e+170 < (/ (* x (+ y z)) z) < 30542.54560779808 or 7.42645860377612e+296 < (/ (* x (+ y z)) z) Initial program 18.0
rmApplied associate-/l*0.8
if -inf.0 < (/ (* x (+ y z)) z) < -1.2404393411255174e+170 or 30542.54560779808 < (/ (* x (+ y z)) z) < 7.42645860377612e+296Initial program 0.2
Final simplification0.7
herbie shell --seed 2020120
(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))