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




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.0 |
|---|---|
| Target | 3.1 |
| Herbie | 1.7 |
if x < -2.65206373301685495e60 or 8.9972701100731221e-116 < x Initial program 19.0
Simplified0.6
if -2.65206373301685495e60 < x < 8.9972701100731221e-116Initial program 5.6
Simplified5.9
Taylor expanded in y around 0 2.8
Final simplification1.7
herbie shell --seed 2022068
(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))