\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq 1102539.5060136039 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \leq 6.050063273952053 \cdot 10^{+226}\right):\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\end{array}double code(double x, double y, double z) {
return (((double) (x * ((double) (y + z)))) / z);
}
double code(double x, double y, double z) {
double VAR;
if ((((((double) (x * ((double) (y + z)))) / z) <= 1102539.5060136039) || !((((double) (x * ((double) (y + z)))) / z) <= 6.050063273952053e+226))) {
VAR = ((double) (x + ((double) (x * (y / z)))));
} else {
VAR = (((double) (x * ((double) (y + z)))) / z);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.0 |
| Herbie | 2.2 |
if (/ (* x (+ y z)) z) < 1102539.5060136039 or 6.0500632739520535e226 < (/ (* x (+ y z)) z) Initial program 15.2
Simplified2.6
if 1102539.5060136039 < (/ (* x (+ y z)) z) < 6.0500632739520535e226Initial program 0.2
Final simplification2.2
herbie shell --seed 2020199
(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))