\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -inf.0 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -3.42029972732376873 \cdot 10^{53} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.04003448335013346 \cdot 10^{43} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.34776453281329523 \cdot 10^{294}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{y + z}{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)) <= -3.4202997273237687e+53) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.0400344833501335e+43) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= 2.3477645328132952e+294))))) {
VAR = ((double) (x * ((double) (((double) (y + z)) / 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 | 12.7 |
|---|---|
| Target | 3.2 |
| Herbie | 0.3 |
if (/ (* x (+ y z)) z) < -inf.0 or -3.42029972732376873e53 < (/ (* x (+ y z)) z) < 1.04003448335013346e43 or 2.34776453281329523e294 < (/ (* x (+ y z)) z) Initial program 19.1
rmApplied *-un-lft-identity19.1
Applied times-frac0.3
Simplified0.3
if -inf.0 < (/ (* x (+ y z)) z) < -3.42029972732376873e53 or 1.04003448335013346e43 < (/ (* x (+ y z)) z) < 2.34776453281329523e294Initial program 0.2
Final simplification0.3
herbie shell --seed 2020162
(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))