1 /* Read decimal floating point numbers.
2 This file is part of the GNU C Library.
3 Copyright (C) 1995-2020 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 <https://www.gnu.org/licenses/>. */
20 #include <bits/floatn.h>
23 # define BUILD_DOUBLE 0
25 # define BUILD_DOUBLE 1
29 # if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
30 # define strtof64 __hide_strtof64
31 # define wcstof64 __hide_wcstof64
33 # if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
34 # define strtof32x __hide_strtof32x
35 # define wcstof32x __hide_wcstof32x
41 #include <locale/localeinfo.h>
45 # include <math_ldbl_opt.h>
48 # define STRTOF wcstod
49 # define STRTOF_L __wcstod_l
51 # define STRTOF strtod
52 # define STRTOF_L __strtod_l
58 # define STRING_TYPE wchar_t
60 # define STRING_TYPE char
63 #define INTERNAL(x) INTERNAL1(x)
64 #define INTERNAL1(x) __##x##_internal
68 INTERNAL (STRTOF
) (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
, int group
)
70 return INTERNAL(STRTOF_L
) (nptr
, endptr
, group
, _NL_CURRENT_LOCALE
);
73 libc_hidden_def (INTERNAL (STRTOF
))
81 STRTOF (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
)
83 return INTERNAL(STRTOF_L
) (nptr
, endptr
, 0, _NL_CURRENT_LOCALE
);
86 libc_hidden_def (STRTOF
)
89 #ifdef LONG_DOUBLE_COMPAT
90 # if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
92 compat_symbol (libc
, wcstod
, wcstold
, GLIBC_2_0
);
93 compat_symbol (libc
, __wcstod_internal
, __wcstold_internal
, GLIBC_2_0
);
95 compat_symbol (libc
, strtod
, strtold
, GLIBC_2_0
);
96 compat_symbol (libc
, __strtod_internal
, __strtold_internal
, GLIBC_2_0
);
102 # if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
105 # ifdef USE_WIDE_CHAR
106 weak_alias (wcstod
, wcstof64
)
108 weak_alias (strtod
, strtof64
)
111 # if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
114 # ifdef USE_WIDE_CHAR
115 weak_alias (wcstod
, wcstof32x
)
117 weak_alias (strtod
, strtof32x
)