1f202adf7SPeter Avalos /*-
2f202adf7SPeter Avalos * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
3f202adf7SPeter Avalos * All rights reserved.
4f202adf7SPeter Avalos *
5*0d5acd74SJohn Marino * Copyright (c) 2011 The FreeBSD Foundation
6*0d5acd74SJohn Marino * All rights reserved.
7*0d5acd74SJohn Marino * Portions of this software were developed by David Chisnall
8*0d5acd74SJohn Marino * under sponsorship from the FreeBSD Foundation.
9*0d5acd74SJohn Marino *
10f202adf7SPeter Avalos * Redistribution and use in source and binary forms, with or without
11f202adf7SPeter Avalos * modification, are permitted provided that the following conditions
12f202adf7SPeter Avalos * are met:
13f202adf7SPeter Avalos * 1. Redistributions of source code must retain the above copyright
14f202adf7SPeter Avalos * notice, this list of conditions and the following disclaimer.
15f202adf7SPeter Avalos * 2. Redistributions in binary form must reproduce the above copyright
16f202adf7SPeter Avalos * notice, this list of conditions and the following disclaimer in the
17f202adf7SPeter Avalos * documentation and/or other materials provided with the distribution.
18f202adf7SPeter Avalos *
19f202adf7SPeter Avalos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20f202adf7SPeter Avalos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21f202adf7SPeter Avalos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22f202adf7SPeter Avalos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23f202adf7SPeter Avalos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24f202adf7SPeter Avalos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25f202adf7SPeter Avalos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26f202adf7SPeter Avalos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27f202adf7SPeter Avalos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28f202adf7SPeter Avalos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29f202adf7SPeter Avalos * SUCH DAMAGE.
30f202adf7SPeter Avalos *
31*0d5acd74SJohn Marino * $FreeBSD: head/lib/libc/gdtoa/machdep_ldisx.c 227753 2011-11-20 14:45:42Z theraven $
32f202adf7SPeter Avalos */
33f202adf7SPeter Avalos
34f202adf7SPeter Avalos /*
35f202adf7SPeter Avalos * Machine-dependent glue to integrate David Gay's gdtoa
36f202adf7SPeter Avalos * package into libc for architectures where a long double
37f202adf7SPeter Avalos * is an IEEE extended precision number.
38f202adf7SPeter Avalos */
39f202adf7SPeter Avalos
40*0d5acd74SJohn Marino
41f202adf7SPeter Avalos #include <float.h>
42f202adf7SPeter Avalos
43f202adf7SPeter Avalos #include "gdtoaimp.h"
44f202adf7SPeter Avalos
45f202adf7SPeter Avalos long double
strtold_l(const char * __restrict s,char ** __restrict sp,locale_t locale)46*0d5acd74SJohn Marino strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale)
47f202adf7SPeter Avalos {
48f202adf7SPeter Avalos long double result;
49*0d5acd74SJohn Marino FIX_LOCALE(locale);
50f202adf7SPeter Avalos
51*0d5acd74SJohn Marino strtorx_l(s, sp, FLT_ROUNDS, &result, locale);
52f202adf7SPeter Avalos return result;
53f202adf7SPeter Avalos }
54