\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -8.8206470254466915 \cdot 10^{22}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{elif}\;x \le 1245913285510824:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\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 ((x <= -8.820647025446692e+22)) {
VAR = ((double) (x * ((double) (((double) (y + z)) / z))));
} else {
double VAR_1;
if ((x <= 1245913285510824.0)) {
VAR_1 = ((double) (((double) (((double) (x * y)) / z)) + x));
} else {
VAR_1 = ((double) (x / ((double) (z / ((double) (y + z))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.5 |
|---|---|
| Target | 3.0 |
| Herbie | 1.6 |
if x < -8.8206470254466915e22Initial program 25.0
rmApplied *-un-lft-identity25.0
Applied times-frac0.1
Simplified0.1
if -8.8206470254466915e22 < x < 1245913285510824Initial program 4.8
Taylor expanded around 0 2.6
if 1245913285510824 < x Initial program 24.0
rmApplied associate-/l*0.1
Final simplification1.6
herbie shell --seed 2020175
(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))