\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le 6.8455758493201267 \cdot 10^{-274}:\\
\;\;\;\;\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{z}} \cdot x\right) + x\\
\mathbf{elif}\;z \le 2.39214907321889172 \cdot 10^{23}:\\
\;\;\;\;\frac{y \cdot x}{z} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x + x\\
\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 ((z <= 6.845575849320127e-274)) {
VAR = ((((cbrt(y) * cbrt(y)) / (cbrt(z) * cbrt(z))) * ((cbrt(y) / cbrt(z)) * x)) + x);
} else {
double VAR_1;
if ((z <= 2.3921490732188917e+23)) {
VAR_1 = (((y * x) / z) + x);
} else {
VAR_1 = (((y / z) * x) + x);
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 2.9 |
| Herbie | 1.2 |
if z < 6.845575849320127e-274Initial program 12.9
Simplified3.3
rmApplied fma-udef3.3
rmApplied add-cube-cbrt3.7
Applied add-cube-cbrt3.8
Applied times-frac3.8
Applied associate-*l*1.2
if 6.845575849320127e-274 < z < 2.3921490732188917e+23Initial program 5.3
Simplified6.3
rmApplied fma-udef6.3
rmApplied associate-*l/2.7
if 2.3921490732188917e+23 < z Initial program 16.9
Simplified0.1
rmApplied fma-udef0.1
Final simplification1.2
herbie shell --seed 2020102 +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))