/****************************************************************12The author of this software is David M. Gay.34Copyright (C) 1998, 2000 by Lucent Technologies5All Rights Reserved67Permission to use, copy, modify, and distribute this software and8its documentation for any purpose and without fee is hereby9granted, provided that the above copyright notice appear in all10copies and that both that the copyright notice and this11permission notice and warranty disclaimer appear in supporting12documentation, and that the name of Lucent or any of its entities13not be used in advertising or publicity pertaining to14distribution of the software without specific, written prior15permission.1617LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,18INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.19IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY20SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES21WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER22IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,23ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF24THIS SOFTWARE.2526****************************************************************/2728/* Please send bug reports to David M. Gay (dmg at acm dot org,29* with " at " changed at "@" and " dot " changed to "."). */3031/* $FreeBSD$ */3233#include "gdtoaimp.h"3435float36#ifdef KR_headers37strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;38#else39strtof_l(CONST char *s, char **sp, locale_t loc)40#endif41{42static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI };43ULong bits[1];44Long exp;45int k;46union { ULong L[1]; float f; } u;47#ifdef Honor_FLT_ROUNDS48#include "gdtoa_fltrnds.h"49#else50#define fpi &fpi051#endif5253k = strtodg_l(s, sp, fpi, &exp, bits, loc);54switch(k & STRTOG_Retmask) {55case STRTOG_NoNumber:56case STRTOG_Zero:57u.L[0] = 0;58break;5960case STRTOG_Normal:61u.L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23);62break;6364case STRTOG_NaNbits:65/* FreeBSD local: always return a quiet NaN */66u.L[0] = bits[0] | 0x7fc00000;67break;6869case STRTOG_Denormal:70u.L[0] = bits[0];71break;7273case STRTOG_Infinite:74u.L[0] = 0x7f800000;75break;7677case STRTOG_NaN:78u.L[0] = f_QNAN;79}80if (k & STRTOG_Neg)81u.L[0] |= 0x80000000L;82return u.f;83}84float85#ifdef KR_headers86strtof(s, sp) CONST char *s; char **sp;87#else88strtof(CONST char *s, char **sp)89#endif90{91return strtof_l(s, sp, __get_locale());92}93949596