diff --git a/library/amiga.lib_rev.h b/library/amiga.lib_rev.h index cb96262..3e7f384 100644 --- a/library/amiga.lib_rev.h +++ b/library/amiga.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "amiga.lib 1.171" -#define VSTRING "amiga.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: amiga.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "amiga.lib 1.172" +#define VSTRING "amiga.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: amiga.lib 1.172 (21.8.2004)" diff --git a/library/amiga.lib_rev.rev b/library/amiga.lib_rev.rev index b34c321..730a054 100644 --- a/library/amiga.lib_rev.rev +++ b/library/amiga.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/c.lib_rev.h b/library/c.lib_rev.h index eb9bcbc..8fcf3e9 100644 --- a/library/c.lib_rev.h +++ b/library/c.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "c.lib 1.171" -#define VSTRING "c.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: c.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "c.lib 1.172" +#define VSTRING "c.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: c.lib 1.172 (21.8.2004)" diff --git a/library/c.lib_rev.rev b/library/c.lib_rev.rev index b34c321..730a054 100644 --- a/library/c.lib_rev.rev +++ b/library/c.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/changes b/library/changes index 064b482..015530b 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,20 @@ +c.lib 1.172 (21.8.2004) + +- acos() now returns 0 for a domain error. + +- asin() now returns 0 for a domain error. + +- atan2() now returns 0 for a domain error. + +- fmod() now returns x if y == 0 and sets a + domain error. + +- sqrt() now returns 0 for a domain error. + +- Added NaN and +Inf constants to the math library + initialization code which could come in handy later. + + c.lib 1.171 (16.8.2004) - Added "math_hypot.c" diff --git a/library/debug.lib_rev.h b/library/debug.lib_rev.h index 6820439..9a59ea3 100644 --- a/library/debug.lib_rev.h +++ b/library/debug.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "debug.lib 1.171" -#define VSTRING "debug.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: debug.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "debug.lib 1.172" +#define VSTRING "debug.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: debug.lib 1.172 (21.8.2004)" diff --git a/library/debug.lib_rev.rev b/library/debug.lib_rev.rev index b34c321..730a054 100644 --- a/library/debug.lib_rev.rev +++ b/library/debug.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/m.lib_rev.h b/library/m.lib_rev.h index 97ebf78..62d39e9 100644 --- a/library/m.lib_rev.h +++ b/library/m.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "m.lib 1.171" -#define VSTRING "m.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: m.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "m.lib 1.172" +#define VSTRING "m.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: m.lib 1.172 (21.8.2004)" diff --git a/library/m.lib_rev.rev b/library/m.lib_rev.rev index b34c321..730a054 100644 --- a/library/m.lib_rev.rev +++ b/library/m.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/m881.lib_rev.h b/library/m881.lib_rev.h index 2874f84..dd44538 100644 --- a/library/m881.lib_rev.h +++ b/library/m881.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "m881.lib 1.171" -#define VSTRING "m881.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: m881.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "m881.lib 1.172" +#define VSTRING "m881.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: m881.lib 1.172 (21.8.2004)" diff --git a/library/m881.lib_rev.rev b/library/m881.lib_rev.rev index b34c321..730a054 100644 --- a/library/m881.lib_rev.rev +++ b/library/m881.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/math_acos.c b/library/math_acos.c index d920ff5..c034077 100644 --- a/library/math_acos.c +++ b/library/math_acos.c @@ -1,5 +1,5 @@ /* - * $Id: math_acos.c,v 1.1.1.1 2004-07-26 16:30:37 obarthel Exp $ + * $Id: math_acos.c,v 1.2 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -226,7 +226,7 @@ acos(double x) } else { - result = HUGE_VAL; + result = 0; errno = EDOM; } diff --git a/library/math_asin.c b/library/math_asin.c index 8237047..44ceca6 100644 --- a/library/math_asin.c +++ b/library/math_asin.c @@ -1,5 +1,5 @@ /* - * $Id: math_asin.c,v 1.1.1.1 2004-07-26 16:30:38 obarthel Exp $ + * $Id: math_asin.c,v 1.2 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -237,7 +237,7 @@ asin(double x) } else { - result = HUGE_VAL; + result = 0; errno = EDOM; } diff --git a/library/math_atan2.c b/library/math_atan2.c index 00a8ae7..5a0fce2 100644 --- a/library/math_atan2.c +++ b/library/math_atan2.c @@ -1,5 +1,5 @@ /* - * $Id: math_atan2.c,v 1.1.1.1 2004-07-26 16:30:39 obarthel Exp $ + * $Id: math_atan2.c,v 1.2 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -107,7 +107,7 @@ __atan2(double x,double y) } else { - result = HUGE_VAL; + result = 0; errno = EDOM; } } @@ -186,7 +186,7 @@ __atan2(double x,double y) } else { - result = HUGE_VAL; + result = 0; errno = EDOM; } } @@ -201,9 +201,6 @@ __atan2(double x,double y) #if defined(PPC_FLOATING_POINT_SUPPORT) - - - static const double tiny = 1.0e-300, zero = 0.0, @@ -326,15 +323,7 @@ atan2(double x,double y) { double result; - if(x != 0.0 && y != 0.0) - { - result = __atan2(x,y); - } - else - { - result = HUGE_VAL; - errno = EDOM; - } + result = __atan2(x,y); return(result); } diff --git a/library/math_data.c b/library/math_data.c index c946510..4d19d4a 100644 --- a/library/math_data.c +++ b/library/math_data.c @@ -1,5 +1,5 @@ /* - * $Id: math_data.c,v 1.1.1.1 2004-07-26 16:30:40 obarthel Exp $ + * $Id: math_data.c,v 1.2 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -48,3 +48,5 @@ struct Library * MathIeeeDoubTransBase; /****************************************************************************/ double __huge_val; +double __not_a_number; +double __infinity; diff --git a/library/math_fmod.c b/library/math_fmod.c index d20564d..b4cdbc6 100644 --- a/library/math_fmod.c +++ b/library/math_fmod.c @@ -1,5 +1,5 @@ /* - * $Id: math_fmod.c,v 1.1.1.1 2004-07-26 16:30:44 obarthel Exp $ + * $Id: math_fmod.c,v 1.2 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -284,7 +284,7 @@ fmod(double x,double y) } else { - result = HUGE_VAL; + result = x; errno = EDOM; } diff --git a/library/math_headers.h b/library/math_headers.h index 7a2cfb0..04a566b 100644 --- a/library/math_headers.h +++ b/library/math_headers.h @@ -1,5 +1,5 @@ /* - * $Id: math_headers.h,v 1.2 2004-08-12 12:31:16 obarthel Exp $ + * $Id: math_headers.h,v 1.3 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -165,4 +165,9 @@ extern double __scalbn(double x, int n); /****************************************************************************/ +extern double __not_a_number; +extern double __infinity; + +/****************************************************************************/ + #endif /* _MATH_HEADERS_H */ diff --git a/library/math_init_exit.c b/library/math_init_exit.c index 3fb5edb..19ec455 100644 --- a/library/math_init_exit.c +++ b/library/math_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: math_init_exit.c,v 1.2 2004-08-08 10:55:57 obarthel Exp $ + * $Id: math_init_exit.c,v 1.3 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -130,9 +130,23 @@ __math_init(void) 0x7f7fffff }; + static const unsigned long not_a_number[1] = + { + /* Exponent = 255 and fraction != 0.0 */ + 0x7fffffff + }; + + static const unsigned long infinity[1] = + { + /* Exponent = 255 and fraction = 0.0 */ + 0x7f800000 + }; + assert( sizeof(largest_fp_value) == sizeof(__huge_val) ); memmove((void *)&__huge_val,largest_fp_value,sizeof(largest_fp_value)); + memmove((void *)&__not_a_number,not_a_number,sizeof(not_a_number)); + memmove((void *)&__infinity,infinity,sizeof(infinity)); } else if (sizeof(__huge_val) == 8) /* double precision */ { @@ -142,9 +156,23 @@ __math_init(void) 0x7fefffff,0xffffffff }; + static const unsigned long not_a_number[2] = + { + /* Exponent = 2047 and fraction != 0.0 */ + 0x7fffffff,0xffffffff + }; + + static const unsigned long infinity[2] = + { + /* Exponent = 2047 and fraction = 0.0 */ + 0x7ff00000,0x00000000 + }; + assert( sizeof(largest_fp_value) == sizeof(__huge_val) ); memmove((void *)&__huge_val,largest_fp_value,sizeof(largest_fp_value)); + memmove((void *)&__not_a_number,not_a_number,sizeof(not_a_number)); + memmove((void *)&__infinity,infinity,sizeof(infinity)); } #if defined(USE_LONG_DOUBLE) else if (sizeof(__huge_val) == 12) /* extended precision */ @@ -155,9 +183,23 @@ __math_init(void) 0x7ffe0000,0xffffffff,0xffffffff }; + static const unsigned long not_a_number[3] = + { + /* Exponent = 32767 and fraction != 0.0 */ + 0x7fff0000,0xffffffff,0xffffffff + }; + + static const unsigned long infinity[3] = + { + /* Exponent = 32767 and fraction = 0.0 */ + 0x7fff0000,0x00000000,0x00000000 + }; + assert( sizeof(largest_fp_value) == sizeof(__huge_val) ); memmove((void *)&__huge_val,largest_fp_value,sizeof(largest_fp_value)); + memmove((void *)&__not_a_number,not_a_number,sizeof(not_a_number)); + memmove((void *)&__infinity,infinity,sizeof(infinity)); } #endif /* USE_LONG_DOUBLE */ diff --git a/library/math_sqrt.c b/library/math_sqrt.c index 59b5bae..a898606 100644 --- a/library/math_sqrt.c +++ b/library/math_sqrt.c @@ -1,5 +1,5 @@ /* - * $Id: math_sqrt.c,v 1.1.1.1 2004-07-26 16:30:53 obarthel Exp $ + * $Id: math_sqrt.c,v 1.2 2004-08-21 18:57:40 obarthel Exp $ * * :ts=4 * @@ -251,7 +251,7 @@ sqrt(double x) } else { - result = HUGE_VAL; + result = 0; errno = EDOM; } diff --git a/library/net.lib_rev.h b/library/net.lib_rev.h index ad0d9c3..4eec714 100644 --- a/library/net.lib_rev.h +++ b/library/net.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "net.lib 1.171" -#define VSTRING "net.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: net.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "net.lib 1.172" +#define VSTRING "net.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: net.lib 1.172 (21.8.2004)" diff --git a/library/net.lib_rev.rev b/library/net.lib_rev.rev index b34c321..730a054 100644 --- a/library/net.lib_rev.rev +++ b/library/net.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/releasenotes b/library/releasenotes index c78b103..9248488 100644 --- a/library/releasenotes +++ b/library/releasenotes @@ -1,3 +1,12 @@ +c.lib 1.172 (21.8.2004) + +- Changed the values which the acos(), asin(), atan2(), fmod() + and sqrt() functions return when they find that their parameters + are invalid. + +- The atan2() function failed to perform a correct parameter check. + + c.lib 1.171 (16.8.2004) - Added hypot() diff --git a/library/stack.lib_rev.h b/library/stack.lib_rev.h index 9cf0edd..c14d349 100644 --- a/library/stack.lib_rev.h +++ b/library/stack.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "stack.lib 1.171" -#define VSTRING "stack.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: stack.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "stack.lib 1.172" +#define VSTRING "stack.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: stack.lib 1.172 (21.8.2004)" diff --git a/library/stack.lib_rev.rev b/library/stack.lib_rev.rev index b34c321..730a054 100644 --- a/library/stack.lib_rev.rev +++ b/library/stack.lib_rev.rev @@ -1 +1 @@ -171 +172 diff --git a/library/unix.lib_rev.h b/library/unix.lib_rev.h index ad22adb..bef4051 100644 --- a/library/unix.lib_rev.h +++ b/library/unix.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 171 -#define DATE "16.8.2004" -#define VERS "unix.lib 1.171" -#define VSTRING "unix.lib 1.171 (16.8.2004)\r\n" -#define VERSTAG "\0$VER: unix.lib 1.171 (16.8.2004)" +#define REVISION 172 +#define DATE "21.8.2004" +#define VERS "unix.lib 1.172" +#define VSTRING "unix.lib 1.172 (21.8.2004)\r\n" +#define VERSTAG "\0$VER: unix.lib 1.172 (21.8.2004)" diff --git a/library/unix.lib_rev.rev b/library/unix.lib_rev.rev index b34c321..730a054 100644 --- a/library/unix.lib_rev.rev +++ b/library/unix.lib_rev.rev @@ -1 +1 @@ -171 +172