1/* Copyright (C) 1999-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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 <https://www.gnu.org/licenses/>. */
17
18#include <bits/floatn.h>
19
20#if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128
21# define strtof128_l __hide_strtof128_l
22# define wcstof128_l __hide_wcstof128_l
23#endif
24
25#if __HAVE_FLOAT64X_LONG_DOUBLE
26# define strtof64x_l __hide_strtof64x_l
27# define wcstof64x_l __hide_wcstof64x_l
28#endif
29
30#include <math.h>
31#include <stdlib.h>
32#include <wchar.h>
33
34/* The actual implementation for all floating point sizes is in strtod.c.
35 These macros tell it to produce the `long double' version, `strtold'. */
36
37#define FLOAT long double
38#define FLT LDBL
39#ifdef USE_WIDE_CHAR
40extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, locale_t);
41# define STRTOF __new_wcstold_l
42# define __STRTOF ____new_wcstold_l
43# define ____STRTOF_INTERNAL ____wcstold_l_internal
44# define STRTOF_NAN __wcstold_nan
45#else
46extern long double ____new_strtold_l (const char *, char **, locale_t);
47# define STRTOF __new_strtold_l
48# define __STRTOF ____new_strtold_l
49# define ____STRTOF_INTERNAL ____strtold_l_internal
50# define STRTOF_NAN __strtold_nan
51#endif
52extern __typeof (__STRTOF) STRTOF;
53libc_hidden_proto (__STRTOF)
54libc_hidden_proto (STRTOF)
55#define MPN2FLOAT __mpn_construct_long_double
56#define FLOAT_HUGE_VAL HUGE_VALL
57
58#include <strtod_l.c>
59
60#ifdef __LONG_DOUBLE_MATH_OPTIONAL
61# include <math_ldbl_opt.h>
62# ifdef USE_WIDE_CHAR
63weak_alias (____new_wcstold_l, ___new_wcstold_l);
64long_double_symbol (libc, ___new_wcstold_l, wcstold_l);
65long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
66# else
67weak_alias (____new_strtold_l, ___new_strtold_l);
68long_double_symbol (libc, ___new_strtold_l, strtold_l);
69long_double_symbol (libc, ____new_strtold_l, __strtold_l);
70# endif
71#endif
72
73#if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128
74# undef strtof128_l
75# undef wcstof128_l
76# ifdef USE_WIDE_CHAR
77weak_alias (____new_wcstold_l, wcstof128_l)
78# else
79weak_alias (____new_strtold_l, strtof128_l)
80# endif
81#endif
82
83#if __HAVE_FLOAT64X_LONG_DOUBLE
84# undef strtof64x_l
85# undef wcstof64x_l
86# ifdef USE_WIDE_CHAR
87weak_alias (____new_wcstold_l, wcstof64x_l)
88# else
89weak_alias (____new_strtold_l, strtof64x_l)
90# endif
91#endif
92

source code of glibc/sysdeps/ieee754/ldbl-64-128/strtold_l.c