Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / ieee754 / ldbl-128ibm / strtold_l.c
blob3e2f69e3534b24ad7d9532ba673afb372575ea9e
1 /* Copyright (C) 1999-2015 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, see
16 <http://www.gnu.org/licenses/>. */
18 #include <math.h>
19 #include <stdlib.h>
20 #include <wchar.h>
21 #include <xlocale.h>
23 /* The actual implementation for all floating point sizes is in strtod.c.
24 These macros tell it to produce the `long double' version, `strtold'. */
26 #define FLOAT long double
27 #define FLT LDBL
28 #ifdef USE_WIDE_CHAR
29 extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
30 # define STRTOF __new_wcstold_l
31 # define __STRTOF ____new_wcstold_l
32 # define ____STRTOF_INTERNAL ____wcstold_l_internal
33 #else
34 extern long double ____new_strtold_l (const char *, char **, __locale_t);
35 # define STRTOF __new_strtold_l
36 # define __STRTOF ____new_strtold_l
37 # define ____STRTOF_INTERNAL ____strtold_l_internal
38 #endif
39 extern __typeof (__STRTOF) STRTOF;
40 libc_hidden_proto (__STRTOF)
41 libc_hidden_proto (STRTOF)
42 #define MPN2FLOAT __mpn_construct_long_double
43 #define FLOAT_HUGE_VAL HUGE_VALL
44 # define SET_MANTISSA(flt, mant) \
45 do { union ibm_extended_long_double u; \
46 u.ld = (flt); \
47 u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \
48 u.d[0].ieee_nan.mantissa1 = (mant); \
49 if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \
50 (flt) = u.ld; \
51 } while (0)
53 #include <strtod_l.c>
55 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
56 # include <math_ldbl_opt.h>
57 # ifdef USE_WIDE_CHAR
58 weak_alias (____new_wcstold_l, ___new_wcstold_l);
59 long_double_symbol (libc, ___new_wcstold_l, wcstold_l);
60 long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
61 # else
62 weak_alias (____new_strtold_l, ___new_strtold_l);
63 long_double_symbol (libc, ___new_strtold_l, strtold_l);
64 long_double_symbol (libc, ____new_strtold_l, __strtold_l);
65 # endif
66 #endif