\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;x \le -1049.34321884997712 \lor \neg \left(x \le 462.815503572335672\right):\\
\;\;\;\;\frac{1}{x} + \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{3}}{\mathsf{fma}\left(-1, 1, {x}^{4}\right)} + \frac{x}{\mathsf{fma}\left(-1, 1, {x}^{4}\right)} \cdot \left(-1\right)\\
\end{array}double f(double x) {
double r94846 = x;
double r94847 = r94846 * r94846;
double r94848 = 1.0;
double r94849 = r94847 + r94848;
double r94850 = r94846 / r94849;
return r94850;
}
double f(double x) {
double r94851 = x;
double r94852 = -1049.3432188499771;
bool r94853 = r94851 <= r94852;
double r94854 = 462.8155035723357;
bool r94855 = r94851 <= r94854;
double r94856 = !r94855;
bool r94857 = r94853 || r94856;
double r94858 = 1.0;
double r94859 = r94858 / r94851;
double r94860 = 1.0;
double r94861 = 5.0;
double r94862 = pow(r94851, r94861);
double r94863 = r94860 / r94862;
double r94864 = 3.0;
double r94865 = pow(r94851, r94864);
double r94866 = r94860 / r94865;
double r94867 = r94863 - r94866;
double r94868 = r94859 + r94867;
double r94869 = -r94860;
double r94870 = 4.0;
double r94871 = pow(r94851, r94870);
double r94872 = fma(r94869, r94860, r94871);
double r94873 = r94865 / r94872;
double r94874 = r94851 / r94872;
double r94875 = r94874 * r94869;
double r94876 = r94873 + r94875;
double r94877 = r94857 ? r94868 : r94876;
return r94877;
}




Bits error versus x
| Original | 15.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
if x < -1049.3432188499771 or 462.8155035723357 < x Initial program 30.7
rmApplied flip-+47.7
Applied associate-/r/47.8
Simplified47.8
Taylor expanded around inf 0.0
Simplified0.0
if -1049.3432188499771 < x < 462.8155035723357Initial program 0.0
rmApplied flip-+0.0
Applied associate-/r/0.0
Simplified0.0
rmApplied sub-neg0.0
Applied distribute-lft-in0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2020081 +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:precision binary64
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))