\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \leq -1.0453651096244319 \cdot 10^{-38} \lor \neg \left(x \leq 1.6296836021789269 \cdot 10^{-167}\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\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 -1.0453651096244319e-38) (not (<= x 1.6296836021789269e-167))) (* x (/ (+ y z) z)) (+ 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 <= -1.0453651096244319e-38) || !(x <= 1.6296836021789269e-167)) {
tmp = x * ((y + z) / z);
} else {
tmp = x + ((x * y) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.1 |
|---|---|
| Target | 2.9 |
| Herbie | 1.9 |
if x < -1.04536510962443192e-38 or 1.6296836021789269e-167 < x Initial program 15.8
rmApplied *-un-lft-identity_binary6415.8
Applied times-frac_binary640.9
Simplified0.9
if -1.04536510962443192e-38 < x < 1.6296836021789269e-167Initial program 6.3
Taylor expanded around 0 3.4
Simplified3.4
Final simplification1.9
herbie shell --seed 2020219
(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))