1d1c90ca8SAxel Dörfler/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
2d1c90ca8SAxel Dörfler   This file is part of the GNU C Library.
3d1c90ca8SAxel Dörfler   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
4d1c90ca8SAxel Dörfler
5d1c90ca8SAxel Dörfler   The GNU C Library is free software; you can redistribute it and/or
6d1c90ca8SAxel Dörfler   modify it under the terms of the GNU Lesser General Public
7d1c90ca8SAxel Dörfler   License as published by the Free Software Foundation; either
8d1c90ca8SAxel Dörfler   version 2.1 of the License, or (at your option) any later version.
9d1c90ca8SAxel Dörfler
10d1c90ca8SAxel Dörfler   The GNU C Library is distributed in the hope that it will be useful,
11d1c90ca8SAxel Dörfler   but WITHOUT ANY WARRANTY; without even the implied warranty of
12d1c90ca8SAxel Dörfler   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13d1c90ca8SAxel Dörfler   Lesser General Public License for more details.
14d1c90ca8SAxel Dörfler
15d1c90ca8SAxel Dörfler   You should have received a copy of the GNU Lesser General Public
16d1c90ca8SAxel Dörfler   License along with the GNU C Library; if not, write to the Free
17d1c90ca8SAxel Dörfler   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18d1c90ca8SAxel Dörfler   02111-1307 USA.  */
19d1c90ca8SAxel Dörfler
20d1c90ca8SAxel Dörfler#include <math.h>
21d1c90ca8SAxel Dörfler#include <wchar.h>
22d1c90ca8SAxel Dörfler
23d1c90ca8SAxel Dörfler#ifndef __NO_LONG_DOUBLE_MATH
24d1c90ca8SAxel Dörfler/* The actual implementation for all floating point sizes is in strtod.c.
25d1c90ca8SAxel Dörfler   These macros tell it to produce the `long double' version, `wcstold'.  */
26d1c90ca8SAxel Dörfler
27d1c90ca8SAxel Dörfler# define FLOAT		long double
28d1c90ca8SAxel Dörfler# define FLT		LDBL
29d1c90ca8SAxel Dörfler# ifdef USE_IN_EXTENDED_LOCALE_MODEL
30d1c90ca8SAxel Dörfler#  define STRTOF	__wcstold_l
31d1c90ca8SAxel Dörfler# else
32d1c90ca8SAxel Dörfler#  define STRTOF	wcstold
33d1c90ca8SAxel Dörfler# endif
34d1c90ca8SAxel Dörfler# define MPN2FLOAT	__mpn_construct_long_double
35d1c90ca8SAxel Dörfler# define FLOAT_HUGE_VAL	HUGE_VALL
36d1c90ca8SAxel Dörfler# define USE_WIDE_CHAR	1
37d1c90ca8SAxel Dörfler# define SET_MANTISSA(flt, mant) \
38d1c90ca8SAxel Dörfler  do { union ieee854_long_double u;					      \
39d1c90ca8SAxel Dörfler       u.d = (flt);							      \
40d1c90ca8SAxel Dörfler       if ((mant & 0x7fffffffffffffffULL) == 0)				      \
41d1c90ca8SAxel Dörfler	 mant = 0x4000000000000000ULL;					      \
42d1c90ca8SAxel Dörfler       u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000;	      \
43d1c90ca8SAxel Dörfler       u.ieee.mantissa1 = (mant) & 0xffffffff;				      \
44d1c90ca8SAxel Dörfler       (flt) = u.d;							      \
45d1c90ca8SAxel Dörfler  } while (0)
46d1c90ca8SAxel Dörfler
47d1c90ca8SAxel Dörfler# include <stdlib/strtod.c>
48d1c90ca8SAxel Dörfler#else
49d1c90ca8SAxel Dörfler/* There is no `long double' type, use the `double' implementations.  */
50d1c90ca8SAxel Dörflerlong double
51d1c90ca8SAxel Dörfler__wcstold_internal (const wchar_t *nptr, wchar_t **endptr, int group)
52d1c90ca8SAxel Dörfler{
53d1c90ca8SAxel Dörfler  return __wcstod_internal (nptr, endptr, group);
54d1c90ca8SAxel Dörfler}
55d1c90ca8SAxel Dörflerlibc_hidden_def (__wcstold_internal)
56d1c90ca8SAxel Dörfler
57d1c90ca8SAxel Dörflerlong double
58d1c90ca8SAxel Dörflerwcstold (const wchar_t *nptr, wchar_t **endptr)
59d1c90ca8SAxel Dörfler{
60d1c90ca8SAxel Dörfler  return __wcstod_internal (nptr, endptr, 0);
61d1c90ca8SAxel Dörfler}
62d1c90ca8SAxel Dörfler#endif
63