\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -4.40375298531076147 \cdot 10^{90}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.52299297723786964 \cdot 10^{132}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.57446106865930061 \cdot 10^{293}:\\
\;\;\;\;\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) <= -inf.0)) {
temp = fma((y / z), x, x);
} else {
double temp_1;
if ((((x * (y + z)) / z) <= -4.4037529853107615e+90)) {
temp_1 = ((x * (y + z)) / z);
} else {
double temp_2;
if ((((x * (y + z)) / z) <= 1.5229929772378696e+132)) {
temp_2 = fma((y / z), x, x);
} else {
double temp_3;
if ((((x * (y + z)) / z) <= 2.5744610686593006e+293)) {
temp_3 = ((x * (y + z)) / z);
} else {
temp_3 = fma((x / z), y, x);
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.5 |
|---|---|
| Target | 3.0 |
| Herbie | 0.8 |
if (/ (* x (+ y z)) z) < -inf.0 or -4.4037529853107615e+90 < (/ (* x (+ y z)) z) < 1.5229929772378696e+132Initial program 11.3
Simplified0.7
if -inf.0 < (/ (* x (+ y z)) z) < -4.4037529853107615e+90 or 1.5229929772378696e+132 < (/ (* x (+ y z)) z) < 2.5744610686593006e+293Initial program 0.2
if 2.5744610686593006e+293 < (/ (* x (+ y z)) z) Initial program 57.6
Taylor expanded around 0 20.5
Simplified3.3
Final simplification0.8
herbie shell --seed 2020049 +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))