x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\begin{array}{l}
\mathbf{if}\;1.1283791670955126 \cdot e^{z} \leq 7.235366708299216 \cdot 10^{-68}:\\
\;\;\;\;x + \frac{1}{-x}\\
\mathbf{elif}\;1.1283791670955126 \cdot e^{z} \leq 1.128379167095513:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 \cdot e^{z}}\\
\end{array}(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
(FPCore (x y z)
:precision binary64
(if (<= (* 1.1283791670955126 (exp z)) 7.235366708299216e-68)
(+ x (/ 1.0 (- x)))
(if (<= (* 1.1283791670955126 (exp z)) 1.128379167095513)
(+ x (/ y (- 1.1283791670955126 (* x y))))
(+ x (/ y (* 1.1283791670955126 (exp z)))))))double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
double code(double x, double y, double z) {
double tmp;
if ((1.1283791670955126 * exp(z)) <= 7.235366708299216e-68) {
tmp = x + (1.0 / -x);
} else if ((1.1283791670955126 * exp(z)) <= 1.128379167095513) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x + (y / (1.1283791670955126 * exp(z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.9 |
|---|---|
| Target | 0.0 |
| Herbie | 0.4 |
if (*.f64 5081767996463981/4503599627370496 (exp.f64 z)) < 7.23536670829921633e-68Initial program 7.5
rmApplied clear-num_binary647.4
Simplified7.4
Taylor expanded around inf 0.1
Simplified0.1
if 7.23536670829921633e-68 < (*.f64 5081767996463981/4503599627370496 (exp.f64 z)) < 1.128379167095513Initial program 0.0
Taylor expanded around 0 0.3
if 1.128379167095513 < (*.f64 5081767996463981/4503599627370496 (exp.f64 z)) Initial program 4.0
Taylor expanded around 0 0.9
Final simplification0.4
herbie shell --seed 2021118
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))