1 /* Read decimal floating point numbers.
2 This file is part of the GNU C Library.
3 Copyright (C) 1995-2023 Free Software Foundation, Inc.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <bits/floatn.h>
22 # define BUILD_DOUBLE 0
24 # define BUILD_DOUBLE 1
28 # if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
29 # define strtof64 __hide_strtof64
30 # define wcstof64 __hide_wcstof64
32 # if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
33 # define strtof32x __hide_strtof32x
34 # define wcstof32x __hide_wcstof32x
40 #include <locale/localeinfo.h>
44 # include <math_ldbl_opt.h>
47 # define STRTOF wcstod
48 # define STRTOF_L __wcstod_l
50 # define STRTOF strtod
51 # define STRTOF_L __strtod_l
57 # define STRING_TYPE wchar_t
59 # define STRING_TYPE char
62 #define INTERNAL(x) INTERNAL1(x)
63 #define INTERNAL1(x) __##x##_internal
67 INTERNAL (STRTOF
) (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
, int group
)
69 return INTERNAL(STRTOF_L
) (nptr
, endptr
, group
, _NL_CURRENT_LOCALE
);
72 libc_hidden_def (INTERNAL (STRTOF
))
80 STRTOF (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
)
82 return INTERNAL(STRTOF_L
) (nptr
, endptr
, 0, _NL_CURRENT_LOCALE
);
85 libc_hidden_def (STRTOF
)
88 #ifdef LONG_DOUBLE_COMPAT
89 # if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
91 compat_symbol (libc
, wcstod
, wcstold
, GLIBC_2_0
);
92 compat_symbol (libc
, __wcstod_internal
, __wcstold_internal
, GLIBC_2_0
);
94 compat_symbol (libc
, strtod
, strtold
, GLIBC_2_0
);
95 compat_symbol (libc
, __strtod_internal
, __strtold_internal
, GLIBC_2_0
);
101 # if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
104 # ifdef USE_WIDE_CHAR
105 weak_alias (wcstod
, wcstof64
)
107 weak_alias (strtod
, strtof64
)
110 # if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
113 # ifdef USE_WIDE_CHAR
114 weak_alias (wcstod
, wcstof32x
)
116 weak_alias (strtod
, strtof32x
)