1112163Sdas/*- 2112163Sdas * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG> 3112163Sdas * All rights reserved. 4112163Sdas * 5227753Stheraven * Copyright (c) 2011 The FreeBSD Foundation 6227753Stheraven * All rights reserved. 7227753Stheraven * Portions of this software were developed by David Chisnall 8227753Stheraven * under sponsorship from the FreeBSD Foundation. 9227753Stheraven * 10112163Sdas * Redistribution and use in source and binary forms, with or without 11112163Sdas * modification, are permitted provided that the following conditions 12112163Sdas * are met: 13112163Sdas * 1. Redistributions of source code must retain the above copyright 14112163Sdas * notice, this list of conditions and the following disclaimer. 15112163Sdas * 2. Redistributions in binary form must reproduce the above copyright 16112163Sdas * notice, this list of conditions and the following disclaimer in the 17112163Sdas * documentation and/or other materials provided with the distribution. 18112163Sdas * 19112163Sdas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20112163Sdas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21112163Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22112163Sdas * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23112163Sdas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24112163Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25112163Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26112163Sdas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27112163Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28112163Sdas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29112163Sdas * SUCH DAMAGE. 30112163Sdas */ 31112163Sdas 32112163Sdas/* 33112163Sdas * Machine-dependent glue to integrate David Gay's gdtoa 34112163Sdas * package into libc for architectures where a long double 35112163Sdas * is an IEEE extended precision number. 36112163Sdas */ 37112163Sdas 38112163Sdas#include <sys/cdefs.h> 39112163Sdas__FBSDID("$FreeBSD$"); 40112163Sdas 41174204Sdas#include <float.h> 42174204Sdas 43112163Sdas#include "gdtoaimp.h" 44112163Sdas 45112163Sdaslong double 46227753Stheravenstrtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale) 47112163Sdas{ 48112163Sdas long double result; 49227753Stheraven FIX_LOCALE(locale); 50112163Sdas 51227753Stheraven strtorx_l(s, sp, FLT_ROUNDS, &result, locale); 52112163Sdas return result; 53112163Sdas} 54