\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;x \leq -1137686.7161830382 \lor \neg \left(x \leq 399.4443248046047\right):\\
\;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - {\left(\frac{1}{x}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x \cdot x}} \cdot \frac{x}{\sqrt{1 + x \cdot x}}\\
\end{array}(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x) :precision binary64 (if (or (<= x -1137686.7161830382) (not (<= x 399.4443248046047))) (- (+ (/ 1.0 x) (/ 1.0 (pow x 5.0))) (pow (/ 1.0 x) 3.0)) (* (/ 1.0 (sqrt (+ 1.0 (* x x)))) (/ x (sqrt (+ 1.0 (* x x)))))))
double code(double x) {
return x / ((x * x) + 1.0);
}
double code(double x) {
double tmp;
if ((x <= -1137686.7161830382) || !(x <= 399.4443248046047)) {
tmp = ((1.0 / x) + (1.0 / pow(x, 5.0))) - pow((1.0 / x), 3.0);
} else {
tmp = (1.0 / sqrt(1.0 + (x * x))) * (x / sqrt(1.0 + (x * x)));
}
return tmp;
}




Bits error versus x
Results
| Original | 15.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
if x < -1137686.7161830382 or 399.444324804604719 < x Initial program 30.6
Taylor expanded around inf 0.0
Simplified0.0
if -1137686.7161830382 < x < 399.444324804604719Initial program 0.0
rmApplied add-sqr-sqrt_binary64_7720.0
Applied *-un-lft-identity_binary64_7510.0
Applied times-frac_binary64_7570.0
Final simplification0.0
herbie shell --seed 2020303
(FPCore (x)
:name "x / (x^2 + 1)"
:precision binary64
:herbie-target
(/ 1.0 (+ x (/ 1.0 x)))
(/ x (+ (* x x) 1.0)))