\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -6.81645975360239147 \cdot 10^{22}:\\
\;\;\;\;\frac{y + z}{\frac{z}{x}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 9.4379571976082544 \cdot 10^{24}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 5.1520249441474563 \cdot 10^{216}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\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)) <= -6.8164597536023915e+22)) {
VAR = ((double) (((double) (y + z)) / ((double) (z / x))));
} else {
double VAR_1;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 9.437957197608254e+24)) {
VAR_1 = ((double) fma(((double) (y / z)), x, x));
} else {
double VAR_2;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 5.1520249441474563e+216)) {
VAR_2 = ((double) (((double) (x * ((double) (y + z)))) / z));
} else {
VAR_2 = ((double) fma(((double) (y / z)), x, x));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.7 |
|---|---|
| Target | 2.8 |
| Herbie | 2.3 |
if (/ (* x (+ y z)) z) < -6.8164597536023915e+22Initial program 18.6
rmApplied *-commutative18.6
Applied associate-/l*5.6
if -6.8164597536023915e+22 < (/ (* x (+ y z)) z) < 9.437957197608254e+24 or 5.1520249441474563e+216 < (/ (* x (+ y z)) z) Initial program 13.1
Simplified1.4
if 9.437957197608254e+24 < (/ (* x (+ y z)) z) < 5.1520249441474563e+216Initial program 0.2
Final simplification2.3
herbie shell --seed 2020113 +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))