From 895d76fed6448bb19559f57195a60ae311d0cac0 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 16 May 2007 19:59:40 +0000 Subject: * libc/include/math.h (INFINITY, NAN, FP_ILOGB0, FP_ILOGBNAN) (MATH_ERRNO, MATH_ERREXCEPT, math_errhandling): Add macros required by POSIX. * libc/stdlib/ldtoa.c (USE_INFINITY): Rename from INFINITY, to avoid clash with . --- newlib/libc/stdlib/ldtoa.c | 57 +++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) (limited to 'newlib/libc/stdlib/ldtoa.c') diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c index 6a29dda9b..d4457938f 100644 --- a/newlib/libc/stdlib/ldtoa.c +++ b/newlib/libc/stdlib/ldtoa.c @@ -1,4 +1,3 @@ - /* Extended precision arithmetic functions for long double I/O. * This program has been placed in the public domain. */ @@ -244,7 +243,7 @@ static char *ermsg[7] = { * * Exception flags are NOT fully supported. * - * Define INFINITY in mconf.h for support of infinity; otherwise a + * Define USE_INFINITY in mconf.h for support of infinity; otherwise a * saturation arithmetic is implemented. * * Define NANS for support of Not-a-Number items; otherwise the @@ -381,12 +380,12 @@ typedef struct #define VOLATILE #define NANS -#define INFINITY +#define USE_INFINITY /* NaN's require infinity support. */ #ifdef NANS #ifndef INFINITY -#define INFINITY +#define USE_INFINITY #endif #endif @@ -544,7 +543,7 @@ static void einfin(register short unsigned int *x, register LDPARMS *ldp) { register int i; -#ifdef INFINITY +#ifdef USE_INFINITY for( i=0; i NBITS ) { ecleazs( s ); @@ -1181,7 +1180,7 @@ if( j > NBITS ) } #endif exp -= j; -#ifndef INFINITY +#ifndef USE_INFINITY if( exp >= 32767L ) goto overf; #else @@ -1329,10 +1328,10 @@ mdfin: s[NI-1] = 0; if( exp >= 32767L ) { -#ifndef INFINITY +#ifndef USE_INFINITY overf: #endif -#ifdef INFINITY +#ifdef USE_INFINITY s[1] = 32767; for( i=2; i= (unsigned int )2047 ) { /* Saturate at largest number less than infinity. */ -#ifdef INFINITY +#ifdef USE_INFINITY *y |= 0x7ff0; #ifdef IBMPC *(--y) = 0; @@ -2132,7 +2131,7 @@ if( i >= (unsigned int )2047 ) *y++ = 0; *y++ = 0; #endif /* IBMPC */ -#else /* !INFINITY */ +#else /* !USE_INFINITY */ *y |= (unsigned short )0x7fef; #ifdef IBMPC *(--y) = 0xffff; @@ -2144,7 +2143,7 @@ if( i >= (unsigned int )2047 ) *y++ = 0xffff; *y++ = 0xffff; #endif -#endif /* !INFINITY */ +#endif /* !USE_INFINITY */ return; } if( i == 0 ) @@ -2202,7 +2201,7 @@ if( r & 0x8000 ) yy[0] = 0xffff; yy[M] = (r & 0x7f) | 0200; r &= ~0x807f; /* strip sign and 7 significand bits */ -#ifdef INFINITY +#ifdef USE_INFINITY if( r == 0x7f80 ) { #ifdef NANS @@ -2285,7 +2284,7 @@ if( *p++ ) i = *p++; if( i >= 255 ) { /* Saturate at largest number less than infinity. */ -#ifdef INFINITY +#ifdef USE_INFINITY *y |= (unsigned short )0x7f80; #ifdef IBMPC *(--y) = 0; @@ -2297,7 +2296,7 @@ if( i >= 255 ) ++y; *y = 0; #endif -#else /* !INFINITY */ +#else /* !USE_INFINITY */ *y |= (unsigned short )0x7f7f; #ifdef IBMPC *(--y) = 0xffff; @@ -2309,7 +2308,7 @@ if( i >= 255 ) ++y; *y = 0xffff; #endif -#endif /* !INFINITY */ +#endif /* !USE_INFINITY */ return; } if( i == 0 ) @@ -3743,7 +3742,3 @@ switch( size ) for (i=0; i < n; i++) *nan++ = *p++; } - - - - -- cgit v1.2.3