\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.784404483351111 \cdot 10^{144}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 9.4322673509474408 \cdot 10^{246}:\\
\;\;\;\;\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)) <= 1.784404483351111e+144)) {
VAR = ((double) (x / ((double) (z / ((double) (y + z))))));
} else {
double VAR_1;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 9.43226735094744e+246)) {
VAR_1 = ((double) (((double) (x * ((double) (y + z)))) / z));
} else {
VAR_1 = ((double) fma(((double) (y / z)), x, x));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 3.0 |
| Herbie | 2.4 |
if (/ (* x (+ y z)) z) < 1.784404483351111e+144Initial program 9.4
rmApplied associate-/l*2.3
if 1.784404483351111e+144 < (/ (* x (+ y z)) z) < 9.43226735094744e+246Initial program 0.2
if 9.43226735094744e+246 < (/ (* x (+ y z)) z) Initial program 45.6
Simplified4.2
Final simplification2.4
herbie shell --seed 2020121 +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))