Update.
[glibc.git] / stdlib / strtold.c
blobc808efc74409118e33e99c563cde77126c78c8e7
1 #include <math.h>
3 #ifndef __NO_LONG_DOUBLE_MATH
4 /* The actual implementation for all floating point sizes is in strtod.c.
5 These macros tell it to produce the `long double' version, `strtold'. */
7 # define FLOAT long double
8 # define FLT LDBL
9 # ifdef USE_IN_EXTENDED_LOCALE_MODEL
10 # define STRTOF __strtold_l
11 # else
12 # define STRTOF strtold
13 # endif
14 # define MPN2FLOAT __mpn_construct_long_double
15 # define FLOAT_HUGE_VAL HUGE_VALL
16 # define SET_MANTISSA(flt, mant) \
17 do { union ieee854_long_double u; \
18 u.d = (flt); \
19 if ((mant & 0x7fffffffffffffffULL) == 0) \
20 mant = 0x4000000000000000ULL; \
21 u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000; \
22 u.ieee.mantissa1 = (mant) & 0xffffffff; \
23 (flt) = u.d; \
24 } while (0)
26 # include "strtod.c"
27 #else
28 /* There is no `long double' type, use the `double' implementations. */
29 long double
30 __strtold_internal (const char *nptr, char **endptr, int group)
32 return __strtod_internal (nptr, endptr, group);
35 long double
36 strtold (const char *nptr, char **endptr)
38 return __strtod_internal (nptr, endptr, 0);
40 #endif