This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Andreas Schwab <schwab@suse.de> writes: > Roger Sayle <roger@eyesopen.com> writes: > >> Of course, this issue applies to y0, y1 and yn, and the above changes >> will need to be made consistently to flt-32, dbl-64, ldbl-96 and ldbl-128. > > The same issue exists with exp, exp10 and tgamma (on ppc): And on x86-64 where I tested the patch below. > Failure: exp (NaN) == NaN: Exception "Invalid operation" set > Failure: exp10 (NaN) == NaN: Exception "Invalid operation" set > Failure: tgamma (NaN) == NaN: Exception "Invalid operation" set This comes from sysdeps/ieee754/dbl-64/e_exp.c: if (n > infint) return(zero/zero); /* x is NaN, return invalid */ IMO we should return just the Nan without raising execptions. Ok to commit the appended patch? This fixes all three problems above. Andreas 2003-12-28 Andreas Jaeger <aj@suse.de> * sysdeps/ieee754/dbl-64/e_exp.c: Do not raise execptions for exp(NaN). ============================================================ Index: sysdeps/ieee754/dbl-64/e_exp.c --- sysdeps/ieee754/dbl-64/e_exp.c 26 Aug 2002 22:40:36 -0000 1.8 +++ sysdeps/ieee754/dbl-64/e_exp.c 28 Dec 2003 10:15:50 -0000 @@ -92,10 +92,10 @@ double __ieee754_exp(double x) { if (n <= smallint) return 1.0; if (n >= badint) { - if (n > infint) return(zero/zero); /* x is NaN, return invalid */ + if (n > infint) return(x+x); /* x is NaN */ if (n < infint) return ( (x>0) ? (hhuge*hhuge) : (tiny*tiny) ); /* x is finite, cause either overflow or underflow */ - if (junk1.i[LOW_HALF] != 0) return (zero/zero); /* x is NaN */ + if (junk1.i[LOW_HALF] != 0) return (x+x); /* x is NaN */ return ((x>0)?inf.x:zero ); /* |x| = inf; return either inf or 0 */ } -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |