\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;\frac{x}{x \cdot x + 1} \leq -7.6031176681605265 \cdot 10^{-289}:\\
\;\;\;\;\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}\\
\mathbf{elif}\;\frac{x}{x \cdot x + 1} \leq 0:\\
\;\;\;\;\frac{1}{x} - \frac{1}{{x}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{x \cdot x + 1}} \cdot \frac{1}{\sqrt{x \cdot x + 1}}\\
\end{array}(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x)
:precision binary64
(if (<= (/ x (+ (* x x) 1.0)) -7.6031176681605265e-289)
(/ (/ x (sqrt (+ (* x x) 1.0))) (sqrt (+ (* x x) 1.0)))
(if (<= (/ x (+ (* x x) 1.0)) 0.0)
(- (/ 1.0 x) (/ 1.0 (pow x 3.0)))
(* (/ x (sqrt (+ (* x x) 1.0))) (/ 1.0 (sqrt (+ (* x x) 1.0)))))))double code(double x) {
return x / ((x * x) + 1.0);
}
double code(double x) {
double tmp;
if ((x / ((x * x) + 1.0)) <= -7.6031176681605265e-289) {
tmp = (x / sqrt((x * x) + 1.0)) / sqrt((x * x) + 1.0);
} else if ((x / ((x * x) + 1.0)) <= 0.0) {
tmp = (1.0 / x) - (1.0 / pow(x, 3.0));
} else {
tmp = (x / sqrt((x * x) + 1.0)) * (1.0 / sqrt((x * x) + 1.0));
}
return tmp;
}




Bits error versus x
Results
| Original | 15.0 |
|---|---|
| Target | 0.1 |
| Herbie | 1.0 |
if (/.f64 x (+.f64 (*.f64 x x) 1)) < -7.6031176681605265e-289Initial program 0.1
rmApplied add-sqr-sqrt_binary640.1
Applied *-un-lft-identity_binary640.1
Applied times-frac_binary640.0
Simplified0.0
Simplified0.0
rmApplied associate-*l/_binary640.0
Simplified0.0
if -7.6031176681605265e-289 < (/.f64 x (+.f64 (*.f64 x x) 1)) < -0.0Initial program 56.0
rmApplied add-sqr-sqrt_binary6456.0
Applied *-un-lft-identity_binary6456.0
Applied times-frac_binary6456.0
Simplified56.0
Simplified56.0
Taylor expanded around inf 3.8
if -0.0 < (/.f64 x (+.f64 (*.f64 x x) 1)) Initial program 0.1
rmApplied add-sqr-sqrt_binary640.1
Applied *-un-lft-identity_binary640.1
Applied times-frac_binary640.0
Final simplification1.0
herbie shell --seed 2021119
(FPCore (x)
:name "x / (x^2 + 1)"
:precision binary64
:herbie-target
(/ 1.0 (+ x (/ 1.0 x)))
(/ x (+ (* x x) 1.0)))