diff options
Diffstat (limited to 'src/math/atan.c')
| -rw-r--r-- | src/math/atan.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/atan.c b/src/math/atan.c index 141367cb..6d9eee63 100644 --- a/src/math/atan.c +++ b/src/math/atan.c @@ -3,6 +3,8 @@ #include "errno.h" #include "_tgmath.h" +#include "M_PI_2.c" + /** arc tangent **/ TYPE TGFN(atan)(TYPE x) { @@ -11,6 +13,12 @@ TYPE TGFN(atan)(TYPE x) TYPE power = 1.0; int i; + switch (fpclassify(x)) { + case FP_ZERO: return x; + case FP_INFINITE: return signbit(x) ? - M_PI_2 : M_PI_2; + default: break; + } + if (0) { errno = ERANGE; /* The result cannot be represented */ /* RETURN_FAILURE(CONSTANT(HUGE_VAL), A range error occurred); */ |
