\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq 9.178964882172369 \cdot 10^{-26} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \leq 2.6136428524201943 \cdot 10^{+301}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(if (or (<= (/ (* x (+ y z)) z) 9.178964882172369e-26)
(not (<= (/ (* x (+ y z)) z) 2.6136428524201943e+301)))
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z)))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double tmp;
if ((((x * (y + z)) / z) <= 9.178964882172369e-26) || !(((x * (y + z)) / z) <= 2.6136428524201943e+301)) {
tmp = x / (z / (y + z));
} else {
tmp = (x * (y + z)) / z;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.1 |
| Herbie | 1.6 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < 9.1789648821723689e-26 or 2.6136428524201943e301 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 16.5
rmApplied associate-/l*_binary642.1
if 9.1789648821723689e-26 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.6136428524201943e301Initial program 0.2
Final simplification1.6
herbie shell --seed 2020233
(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))