1 /* Return classification value corresponding to argument.
2 Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
5 Jakub Jelinek <jj@ultra.linux.cz>, 1999.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include "math_private.h"
25 #include <math_ldbl_opt.h>
29 * +NaN 7ffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
30 * -NaN fffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
31 * +Inf 7ff0 0000 0000 0000 xxxx xxxx xxxx xxxx
32 * -Inf fff0 0000 0000 0000 xxxx xxxx xxxx xxxx
33 * +0 0000 0000 0000 0000
34 * -0 8000 0000 0000 0000
35 * +normal 001n nnnn nnnn nnnn (smallest)
36 * -normal 801n nnnn nnnn nnnn (smallest)
37 * +normal 7fen nnnn nnnn nnnn (largest)
38 * -normal ffen nnnn nnnn nnnn (largest)
39 * +denorm 000n nnnn nnnn nnnn
40 * -denorm 800n nnnn nnnn nnnn
44 ___fpclassifyl (long double x
)
47 int retval
= FP_NORMAL
;
49 GET_LDOUBLE_WORDS64 (hx
, lx
, x
);
50 if ((hx
& 0x7ff0000000000000ULL
) == 0x7ff0000000000000ULL
) {
51 /* +/-NaN or +/-Inf */
52 if (hx
& 0x000fffffffffffffULL
) {
59 /* +/-zero or +/- normal or +/- denormal */
60 if (hx
& 0x7fffffffffffffffULL
) {
61 /* +/- normal or +/- denormal */
62 if ((hx
& 0x7ff0000000000000ULL
) >= 0x0360000000000000ULL
) {
67 retval
= FP_SUBNORMAL
;
77 long_double_symbol (libm
, ___fpclassifyl
, __fpclassifyl
);
78 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
79 libm_hidden_ver (___fpclassifyl
, __fpclassifyl
)
81 libm_hidden_def (__fpclassifyl
)