16a66acb5SDavid Schultz /*- 2*d915a14eSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*d915a14eSPedro F. Giffuni * 46a66acb5SDavid Schultz * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG> 56a66acb5SDavid Schultz * All rights reserved. 66a66acb5SDavid Schultz * 73c87aa1dSDavid Chisnall * Copyright (c) 2011 The FreeBSD Foundation 83c87aa1dSDavid Chisnall * All rights reserved. 93c87aa1dSDavid Chisnall * Portions of this software were developed by David Chisnall 103c87aa1dSDavid Chisnall * under sponsorship from the FreeBSD Foundation. 113c87aa1dSDavid Chisnall * 126a66acb5SDavid Schultz * Redistribution and use in source and binary forms, with or without 136a66acb5SDavid Schultz * modification, are permitted provided that the following conditions 146a66acb5SDavid Schultz * are met: 156a66acb5SDavid Schultz * 1. Redistributions of source code must retain the above copyright 166a66acb5SDavid Schultz * notice, this list of conditions and the following disclaimer. 176a66acb5SDavid Schultz * 2. Redistributions in binary form must reproduce the above copyright 186a66acb5SDavid Schultz * notice, this list of conditions and the following disclaimer in the 196a66acb5SDavid Schultz * documentation and/or other materials provided with the distribution. 206a66acb5SDavid Schultz * 216a66acb5SDavid Schultz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 226a66acb5SDavid Schultz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 236a66acb5SDavid Schultz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 246a66acb5SDavid Schultz * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 256a66acb5SDavid Schultz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 266a66acb5SDavid Schultz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 276a66acb5SDavid Schultz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 286a66acb5SDavid Schultz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 296a66acb5SDavid Schultz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 306a66acb5SDavid Schultz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 316a66acb5SDavid Schultz * SUCH DAMAGE. 326a66acb5SDavid Schultz */ 336a66acb5SDavid Schultz 346a66acb5SDavid Schultz /* 356a66acb5SDavid Schultz * Machine-dependent glue to integrate David Gay's gdtoa 366a66acb5SDavid Schultz * package into libc for architectures where a long double 376a66acb5SDavid Schultz * uses quad precision, such as sparc64. 386a66acb5SDavid Schultz */ 396a66acb5SDavid Schultz 406a66acb5SDavid Schultz #include <sys/cdefs.h> 416a66acb5SDavid Schultz __FBSDID("$FreeBSD$"); 426a66acb5SDavid Schultz 439c90f85aSDavid Schultz #include <float.h> 449c90f85aSDavid Schultz 456a66acb5SDavid Schultz #include "gdtoaimp.h" 466a66acb5SDavid Schultz 476a66acb5SDavid Schultz long double 483c87aa1dSDavid Chisnall strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale) 496a66acb5SDavid Schultz { 506a66acb5SDavid Schultz long double result; 516a66acb5SDavid Schultz 523c87aa1dSDavid Chisnall strtorQ_l(s, sp, FLT_ROUNDS, &result, locale); 536a66acb5SDavid Schultz return result; 546a66acb5SDavid Schultz } 55