Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / ieee754 / ldbl-64-128 / strtold_l.c
blobdfa79e99fa615026ba9f553164480bd13cf6d2d2
1 /* Copyright (C) 1999-2014 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 ieee854_long_double u; \
46 u.d = (flt); \
47 u.ieee_nan.mantissa0 = 0; \
48 u.ieee_nan.mantissa1 = 0; \
49 u.ieee_nan.mantissa2 = (mant) >> 32; \
50 u.ieee_nan.mantissa3 = (mant); \
51 if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
52 | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
53 (flt) = u.d; \
54 } while (0)
56 #include <strtod_l.c>
58 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
59 # include <math_ldbl_opt.h>
60 # ifdef USE_WIDE_CHAR
61 weak_alias (____new_wcstold_l, ___new_wcstold_l);
62 long_double_symbol (libc, ___new_wcstold_l, wcstold_l);
63 long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
64 # else
65 weak_alias (____new_strtold_l, ___new_strtold_l);
66 long_double_symbol (libc, ___new_strtold_l, strtold_l);
67 long_double_symbol (libc, ____new_strtold_l, __strtold_l);
68 # endif
69 #endif