2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
12 #include <sys/cdefs.h>
27 if (u.bits.exp == 0) {
28 if ((u.bits.manl | u.bits.manh) == 0) { /* x == 0 */
33 if (u.bits.manh == 0) {
34 m = 1lu << (LDBL_MANL_SIZE - 1);
35 for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1)
38 m = 1lu << (LDBL_MANH_SIZE - 1);
39 for (b = 0; !(u.bits.manh & m); m >>= 1)
42 #ifdef LDBL_IMPLICIT_NBIT
45 return ((long double)(LDBL_MIN_EXP - b - 1));
47 if (u.bits.exp < (LDBL_MAX_EXP << 1) - 1) /* normal */
48 return ((long double)(u.bits.exp - LDBL_MAX_EXP + 1));
49 else /* +/- inf or nan */