Import new sources. The only material change in this update is to

add locale support for hexadecimal floating point conversions.

Noticed by:	ache
Reviewed by:	mike (mentor)
This commit is contained in:
David Schultz 2003-03-25 17:55:07 +00:00
parent 84781d47e6
commit 8f7c2af436
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/gdtoa/dist/; revision=112620
svn path=/vendor/gdtoa/20030324/; revision=112622; tag=vendor/gdtoa/20030324
6 changed files with 23 additions and 33 deletions

View File

@ -320,7 +320,4 @@ it is '.'.
Please send comments to Please send comments to
David M. Gay David M. Gay
Bell Labs, Room 2C-463 dmg@acm.org
600 Mountain Avenue
Murray Hill, NJ 07974-0636, U.S.A.
dmg@research.bell-labs.com

View File

@ -28,11 +28,7 @@ THIS SOFTWARE.
/* Please send bug reports to /* Please send bug reports to
David M. Gay David M. Gay
Bell Laboratories, Room 2C-463 dmg@acm.org
600 Mountain Avenue
Murray Hill, NJ 07974-0636
U.S.A.
dmg@bell-labs.com
*/ */
#include "gdtoaimp.h" #include "gdtoaimp.h"

View File

@ -28,15 +28,15 @@ THIS SOFTWARE.
/* Please send bug reports to /* Please send bug reports to
David M. Gay David M. Gay
Bell Laboratories, Room 2C-463 dmg@acm.org
600 Mountain Avenue
Murray Hill, NJ 07974-0636
U.S.A.
dmg@bell-labs.com
*/ */
#include "gdtoaimp.h" #include "gdtoaimp.h"
#ifdef USE_LOCALE
#include "locale.h"
#endif
int int
#ifdef KR_headers #ifdef KR_headers
gethex(sp, fpi, exp, bp, sign) gethex(sp, fpi, exp, bp, sign)
@ -50,6 +50,11 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
int esign, havedig, irv, k, n, nbits, up; int esign, havedig, irv, k, n, nbits, up;
ULong L, lostbits, *x; ULong L, lostbits, *x;
Long e, e1; Long e, e1;
#ifdef USE_LOCALE
char decimalpoint = *localeconv()->decimal_point;
#else
#define decimalpoint '.'
#endif
if (!hexdig['0']) if (!hexdig['0'])
hexdig_init_D2A(); hexdig_init_D2A();
@ -61,7 +66,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
s = s0; s = s0;
decpt = 0; decpt = 0;
if (!hexdig[*s]) { if (!hexdig[*s]) {
if (*s == '.') { if (*s == decimalpoint) {
decpt = ++s; decpt = ++s;
if (!hexdig[*s]) if (!hexdig[*s])
goto ret0; goto ret0;
@ -80,7 +85,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
} }
while(hexdig[*s]) while(hexdig[*s])
s++; s++;
if (*s == '.' && !decpt) { if (*s == decimalpoint && !decpt) {
decpt = ++s; decpt = ++s;
while(hexdig[*s]) while(hexdig[*s])
s++; s++;
@ -120,7 +125,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
n = 0; n = 0;
L = 0; L = 0;
while(s1 > s0) { while(s1 > s0) {
if (*--s1 == '.') if (*--s1 == decimalpoint)
continue; continue;
if (n == 32) { if (n == 32) {
*x++ = L; *x++ = L;

View File

@ -28,11 +28,7 @@ THIS SOFTWARE.
/* Please send bug reports to /* Please send bug reports to
David M. Gay David M. Gay
Bell Laboratories, Room 2C-463 dmg@acm.org
600 Mountain Avenue
Murray Hill, NJ 07974-0636
U.S.A.
dmg@bell-labs.com
*/ */
#include "gdtoaimp.h" #include "gdtoaimp.h"
@ -118,7 +114,7 @@ strtod
switch(s[1]) { switch(s[1]) {
case 'x': case 'x':
case 'X': case 'X':
switch(gethex(&s, &fpi, &exp, &bb, sign)) { switch(i = gethex(&s, &fpi, &exp, &bb, sign)) {
case STRTOG_NoNumber: case STRTOG_NoNumber:
s = s00; s = s00;
sign = 0; sign = 0;

View File

@ -28,11 +28,7 @@ THIS SOFTWARE.
/* Please send bug reports to /* Please send bug reports to
David M. Gay David M. Gay
Bell Laboratories, Room 2C-463 dmg@acm.org
600 Mountain Avenue
Murray Hill, NJ 07974-0636
U.S.A.
dmg@bell-labs.com
*/ */
#include "gdtoaimp.h" #include "gdtoaimp.h"

View File

@ -1,9 +1,9 @@
README 7150e50 13249 README c9c34c1 13153
arithchk.c e37b8a75 4070 arithchk.c e37b8a75 4070
dmisc.c e8d262b6 4712 dmisc.c e8d262b6 4712
dtoa.c f3c132b3 16905 dtoa.c f3c132b3 16905
g_Qfmt.c e5847e9 2870 g_Qfmt.c e5847e9 2870
g__fmt.c e29d67f1 2534 g__fmt.c ee5f9be0 2439
g_ddfmt.c fcf94527 3790 g_ddfmt.c fcf94527 3790
g_dfmt.c f30e55a9 2533 g_dfmt.c f30e55a9 2533
g_ffmt.c 7c4ea96 2459 g_ffmt.c 7c4ea96 2459
@ -12,7 +12,7 @@ g_xfmt.c c20a5e4 2795
gdtoa.c 364a0d2 17017 gdtoa.c 364a0d2 17017
gdtoa.h 1eb440de 4810 gdtoa.h 1eb440de 4810
gdtoaimp.h 6a955ba 19106 gdtoaimp.h 6a955ba 19106
gethex.c ff3c434d 4981 gethex.c 1310d1b3 5066
gmisc.c e1a268ea 2114 gmisc.c e1a268ea 2114
hd_init.c cf9a94e 1827 hd_init.c cf9a94e 1827
hexnan.c f53be1da 2988 hexnan.c f53be1da 2988
@ -26,9 +26,9 @@ strtoIf.c eb75ac99 1905
strtoIg.c ec59c2fa 3484 strtoIg.c ec59c2fa 3484
strtoIx.c 8f8c9d 1990 strtoIx.c 8f8c9d 1990
strtoIxL.c 1313ff7f 1961 strtoIxL.c 1313ff7f 1961
strtod.c 1ad667 20076 strtod.c fd6556c8 19985
strtodI.c e58338e0 4062 strtodI.c e58338e0 4062
strtodg.c 1caf3fa4 19553 strtodg.c e04b9254 19458
strtof.c 1e7a787a 2202 strtof.c 1e7a787a 2202
strtopQ.c e232c542 2685 strtopQ.c e232c542 2685
strtopd.c e865dc64 1701 strtopd.c e865dc64 1701