\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -5.29259606783455435 \cdot 10^{295}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -7.234852918192252 \cdot 10^{43}:\\
\;\;\;\;\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 ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
double VAR;
if ((((x * (y + z)) / z) <= -5.292596067834554e+295)) {
VAR = fma((x / z), y, x);
} else {
double VAR_1;
if ((((x * (y + z)) / z) <= -7.234852918192252e+43)) {
VAR_1 = ((x * (y + z)) / z);
} else {
VAR_1 = fma((y / z), x, x);
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.2 |
| Herbie | 2.1 |
if (/ (* x (+ y z)) z) < -5.292596067834554e+295Initial program 59.1
Taylor expanded around 0 19.7
Simplified2.1
if -5.292596067834554e+295 < (/ (* x (+ y z)) z) < -7.234852918192252e+43Initial program 0.2
if -7.234852918192252e+43 < (/ (* x (+ y z)) z) Initial program 10.6
Simplified2.5
Final simplification2.1
herbie shell --seed 2020075 +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))