diff options
| author | Andrew Turner <andrew@FreeBSD.org> | 2015-05-29 09:26:10 +0000 |
|---|---|---|
| committer | Andrew Turner <andrew@FreeBSD.org> | 2015-05-29 09:26:10 +0000 |
| commit | 5d8564aec852a919b0d49170569b160e26691146 (patch) | |
| tree | 4f6c8d9e80d48d27e49e0e6c0ebe07b5595f47c0 /lib/libc/gen/fpclassify.c | |
| parent | 275ac7729e3f28635ba6dae02879d27786a7c462 (diff) | |
Notes
Diffstat (limited to 'lib/libc/gen/fpclassify.c')
| -rw-r--r-- | lib/libc/gen/fpclassify.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libc/gen/fpclassify.c b/lib/libc/gen/fpclassify.c index 754a1df50a2f7..444b5513ddf40 100644 --- a/lib/libc/gen/fpclassify.c +++ b/lib/libc/gen/fpclassify.c @@ -29,6 +29,8 @@ #include <sys/endian.h> +#include <machine/float.h> + #include <math.h> #include <stdint.h> @@ -84,10 +86,18 @@ __fpclassifyl(long double e) return (FP_SUBNORMAL); } mask_nbit_l(u); /* Mask normalization bit if applicable. */ +#if LDBL_MANT_DIG == 53 + if (u.bits.exp == 2047) { + if ((u.bits.manl | u.bits.manh) == 0) + return (FP_INFINITE); + return (FP_NAN); + } +#else if (u.bits.exp == 32767) { if ((u.bits.manl | u.bits.manh) == 0) return (FP_INFINITE); return (FP_NAN); } +#endif return (FP_NORMAL); } |
