Consolidate Linux truncate implementations
[glibc.git] / stdlib / strtold.c
blobbb46f23c29709ad9a2d6d90d19d97d2817545e79
1 /* Read decimal floating point numbers.
2 This file is part of the GNU C Library.
3 Copyright (C) 1995-2016 Free Software Foundation, Inc.
4 Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 /* The actual implementation for all floating point sizes is in strtod.c.
21 These macros tell it to produce the `float' version, `strtof'. */
23 #include <bits/wordsize.h>
25 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
26 # include <wchar.h>
27 # define NEW(x) NEW1(x)
28 # define NEW1(x) __new_##x
29 long double ____new_strtold_internal (const char *, char **, int);
30 long double __new_strtold (const char *, char **);
31 long double ____new_wcstold_internal (const wchar_t *, wchar_t **, int);
32 long double __new_wcstold (const wchar_t *, wchar_t **);
33 libc_hidden_proto (____new_strtold_internal)
34 libc_hidden_proto (____new_wcstold_internal)
35 libc_hidden_proto (__new_strtold)
36 libc_hidden_proto (__new_wcstold)
37 #else
38 # define NEW(x) x
39 #endif
41 #define FLOAT long double
42 #define FLT LDBL
43 #ifdef USE_WIDE_CHAR
44 # define STRTOF NEW (wcstold)
45 # define STRTOF_L __wcstold_l
46 #else
47 # define STRTOF NEW (strtold)
48 # define STRTOF_L __strtold_l
49 #endif
51 #include "strtod.c"
53 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
54 # include <math_ldbl_opt.h>
55 # ifdef USE_WIDE_CHAR
56 long_double_symbol (libc, __new_wcstold, wcstold);
57 long_double_symbol (libc, ____new_wcstold_internal, __wcstold_internal);
58 libc_hidden_ver (____new_wcstold_internal, __wcstold_internal)
59 # else
60 long_double_symbol (libc, __new_strtold, strtold);
61 long_double_symbol (libc, ____new_strtold_internal, __strtold_internal);
62 libc_hidden_ver (____new_strtold_internal, __strtold_internal)
63 # endif
64 #endif