|
From: Danny S. <dan...@cl...> - 2005-01-19 09:03:20
|
Greg Chicares wrote: > log1p() would be much more useful if its companion expm1() > [C99 7.12.6.3] were provided as well. Is there a reason not > to have expm1(), other than "no one has contributed it yet"? > > For instance, Conklin, credited as the original author of > /mingw/runtime/mingwex/math/log1pl.S?rev=1.1&view=markup > said in an earlier version > http://www.klid.dk/pub/gnu/gnu-utils/src/libm/src/s_log1p.s > > /* > * Since the fyl2xp1 instruction has such a limited range: > * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 > * it's not worth trying to use it. > */ > > but apparently later realized its worth. Did something like > that happen for expm1()? Hmm...I find Conklin's log1p() in the > netbsd src/lib/libm sources, but no corresponding expm1(). > > I realize expm1() will be an intrinsic in gcc-4.0 > http://www.gnu.org/software/gcc/gcc-4.0/changes.html > but apparently only with '-ffast-math', so there's still > a use for an expm1() that conforms to the language and > numeric standards. > Off top of head, it would be quite easy to do if (x < small_value) { /* Taylor series expansion return y such that additional term is smaller than machine eps */ } else return exp(x) - 1; Not very fast, but I'll bet I can find a good old Fortran IV routine that has been tested as accurate. Danny > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users |