\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;y \leq -5.495148928653015 \cdot 10^{+56} \lor \neg \left(y \leq 1.0694809551932351 \cdot 10^{+101}\right):\\
\;\;\;\;x + y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z) :precision binary64 (if (or (<= y -5.495148928653015e+56) (not (<= y 1.0694809551932351e+101))) (+ x (* y (/ x 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 ((y <= -5.495148928653015e+56) || !(y <= 1.0694809551932351e+101)) {
tmp = x + (y * (x / z));
} else {
tmp = x * ((y + z) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 13.0 |
|---|---|
| Target | 3.0 |
| Herbie | 1.7 |
if y < -5.4951489286530154e56 or 1.0694809551932351e101 < y Initial program 13.3
rmApplied associate-/l*_binary64_130969.2
Taylor expanded around 0 10.8
Simplified4.6
if -5.4951489286530154e56 < y < 1.0694809551932351e101Initial program 12.9
rmApplied *-un-lft-identity_binary64_1315112.9
Applied times-frac_binary64_131570.5
Simplified0.5
Final simplification1.7
herbie shell --seed 2020289
(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))