From: Greg C. <chi...@co...> - 2005-01-29 16:46:31
|
On 2005-01-29 00:41 AM, Danny Smith wrote: > Greg Chicares wrote: > >>On 2005-01-27 03:29 AM, Danny Smith wrote: >> >>>Greg Chicares wrote: >> >>I will. First, though, let's try to solve the M_LN2 problem. >>I'd hate to hardcode a constant value in expm1() now, when what >>we really want is to use that macro, but with a value that's >>not overstated. > > On second thought, hardcoded values of the constants may be the way to go, > particulary if we put inline versions of the functions in math.h. The M_* > defines are !__STRICT_ANSI__, so we can't be sure that they will be visible (eg, > if --std=c99). Good point. I've updated http://sourceforge.net/tracker/index.php?func=detail&aid=1109674&group_id=2435&atid=302435 and I believe it reflects all our discussions to date. Please take a look at the included test program. It shows differences of exactly one between expm1() and exp()-1 for arguments extreme enough to return infinity or indefinite. C99 7.12.6.3/2 says "A range error occurs if x is too large." but 7.12.1/3 doesn't seem to say what an implementation should do when a range error occurs, so I guess anything goes for extremely high arguments. I'm not sure what should happen for an argument of -INF. I get an indefinite for both expm1(-INF) and exp(-INF)-1. 7.12.1/5 seems to allow that if we regard indefinites as representable "without extraordinary roundoff error". |