2.9
[glibc/nacl-glibc.git] / sysdeps / ieee754 / ldbl-64-128 / strtold_l.c
blobcdc30983ecb42dc48d67ac015d87f89df026bdee
1 /* Copyright (C) 1999, 2006, 2007 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #include <math.h>
20 #include <stdlib.h>
21 #include <wchar.h>
22 #include <xlocale.h>
24 /* The actual implementation for all floating point sizes is in strtod.c.
25 These macros tell it to produce the `long double' version, `strtold'. */
27 #define FLOAT long double
28 #define FLT LDBL
29 #ifdef USE_WIDE_CHAR
30 extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
31 # define STRTOF __new_wcstold_l
32 # define __STRTOF ____new_wcstold_l
33 # define ____STRTOF_INTERNAL ____wcstold_l_internal
34 #else
35 extern long double ____new_strtold_l (const char *, char **, __locale_t);
36 # define STRTOF __new_strtold_l
37 # define __STRTOF ____new_strtold_l
38 # define ____STRTOF_INTERNAL ____strtold_l_internal
39 #endif
40 extern __typeof (__STRTOF) STRTOF;
41 libc_hidden_proto (__STRTOF)
42 libc_hidden_proto (STRTOF)
43 #define MPN2FLOAT __mpn_construct_long_double
44 #define FLOAT_HUGE_VAL HUGE_VALL
45 #define SET_MANTISSA(flt, mant) \
46 do { union ieee854_long_double u; \
47 u.d = (flt); \
48 u.ieee.mantissa0 = 0x8000; \
49 u.ieee.mantissa1 = 0; \
50 u.ieee.mantissa2 = ((mant) >> 32); \
51 u.ieee.mantissa3 = (mant) & 0xffffffff; \
52 (flt) = u.d; \
53 } while (0)
55 #include <strtod_l.c>
57 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
58 # include <math_ldbl_opt.h>
59 # ifdef USE_WIDE_CHAR
60 weak_alias (____new_wcstold_l, ___new_wcstold_l);
61 long_double_symbol (libc, ___new_wcstold_l, wcstold_l);
62 long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
63 # else
64 weak_alias (____new_strtold_l, ___new_strtold_l);
65 long_double_symbol (libc, ___new_strtold_l, strtold_l);
66 long_double_symbol (libc, ____new_strtold_l, __strtold_l);
67 # endif
68 #endif