\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.12348942251738224 \cdot 10^{95}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.28734637678198 \cdot 10^{305}:\\
\;\;\;\;\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 ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
double temp;
if ((((x * (y + z)) / z) <= 1.1234894225173822e+95)) {
temp = (x / (z / (y + z)));
} else {
double temp_1;
if ((((x * (y + z)) / z) <= 2.2873463767819766e+305)) {
temp_1 = ((x * (y + z)) / z);
} else {
temp_1 = fma((x / z), y, x);
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 2.8 |
| Herbie | 1.8 |
if (/ (* x (+ y z)) z) < 1.1234894225173822e+95Initial program 9.4
rmApplied associate-/l*2.2
if 1.1234894225173822e+95 < (/ (* x (+ y z)) z) < 2.2873463767819766e+305Initial program 0.2
if 2.2873463767819766e+305 < (/ (* x (+ y z)) z) Initial program 62.6
Taylor expanded around 0 20.2
Simplified0.6
Final simplification1.8
herbie shell --seed 2020056 +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))