\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -6.75135214178766355 \cdot 10^{198}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.94806065160282452 \cdot 10^{-98}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.85109499375252098 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.10698314773329783 \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 ((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)) <= -6.751352141787664e+198)) {
VAR = ((double) fma(((double) (x / z)), y, x));
} else {
double VAR_1;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= -1.9480606516028245e-98)) {
VAR_1 = ((double) (((double) (x * ((double) (y + z)))) / z));
} else {
double VAR_2;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 2.851094993752521e-41)) {
VAR_2 = ((double) fma(((double) (y / z)), x, x));
} else {
double VAR_3;
if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 2.106983147733298e+305)) {
VAR_3 = ((double) (((double) (x * ((double) (y + z)))) / z));
} else {
VAR_3 = ((double) fma(((double) (x / z)), y, x));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.5 |
|---|---|
| Target | 2.9 |
| Herbie | 1.4 |
if (/ (* x (+ y z)) z) < -6.751352141787664e+198 or 2.106983147733298e+305 < (/ (* x (+ y z)) z) Initial program 45.1
Taylor expanded around 0 15.3
Simplified6.0
if -6.751352141787664e+198 < (/ (* x (+ y z)) z) < -1.9480606516028245e-98 or 2.851094993752521e-41 < (/ (* x (+ y z)) z) < 2.106983147733298e+305Initial program 0.3
if -1.9480606516028245e-98 < (/ (* x (+ y z)) z) < 2.851094993752521e-41Initial program 8.7
Simplified0.1
Final simplification1.4
herbie shell --seed 2020123 +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))