\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le 3.53824064468242378 \cdot 10^{93}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.58984662664485094 \cdot 10^{255}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, 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)) <= 3.538240644682424e+93)) {
VAR = ((double) fma(((double) (y / z)), x, x));
} else {
double VAR_1;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.589846626644851e+255)) {
VAR_1 = ((double) (((double) (x * ((double) (y + z)))) / z));
} else {
VAR_1 = ((double) fma(((double) (x / z)), y, x));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 3.0 |
| Herbie | 2.4 |
if (/ (* x (+ y z)) z) < 3.538240644682424e+93Initial program 9.7
Simplified2.4
if 3.538240644682424e+93 < (/ (* x (+ y z)) z) < 1.589846626644851e+255Initial program 0.2
if 1.589846626644851e+255 < (/ (* x (+ y z)) z) Initial program 45.8
Taylor expanded around 0 14.8
Simplified5.3
Final simplification2.4
herbie shell --seed 2020114 +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))