\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;x \leq -1.0053432650789538 \cdot 10^{+55}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;x \leq 437.17389020921524:\\
\;\;\;\;\frac{x}{1 + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x} - {x}^{-3}\right) + \frac{1}{{x}^{5}}\\
\end{array}(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x)
:precision binary64
(if (<= x -1.0053432650789538e+55)
(/ 1.0 x)
(if (<= x 437.17389020921524)
(/ x (+ 1.0 (* x x)))
(+ (- (/ 1.0 x) (pow x -3.0)) (/ 1.0 (pow x 5.0))))))double code(double x) {
return x / ((x * x) + 1.0);
}
double code(double x) {
double tmp;
if (x <= -1.0053432650789538e+55) {
tmp = 1.0 / x;
} else if (x <= 437.17389020921524) {
tmp = x / (1.0 + (x * x));
} else {
tmp = ((1.0 / x) - pow(x, -3.0)) + (1.0 / pow(x, 5.0));
}
return tmp;
}




Bits error versus x
Results
| Original | 15.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
if x < -1.0053432650789538e55Initial program 36.6
Taylor expanded around inf 0
if -1.0053432650789538e55 < x < 437.173890209215244Initial program 0.0
if 437.173890209215244 < x Initial program 31.4
Taylor expanded around inf 0.0
Simplified0.0
rmApplied pow-flip_binary64_8340.0
Final simplification0.0
herbie shell --seed 2021098
(FPCore (x)
:name "x / (x^2 + 1)"
:precision binary64
:herbie-target
(/ 1.0 (+ x (/ 1.0 x)))
(/ x (+ (* x x) 1.0)))