|
From: Greg C. <chi...@co...> - 2005-01-26 08:59:40
|
On 2005-01-26 02:48 AM, Danny Smith wrote: > Greg Chicares wrote: > >>>Maybe I could provide a narrative description of changes to >>> mingw/runtime/mingwex/math/expl.c >>>that would be easy to translate. The intel instruction set actually >>>treats expm1() as the general case, and you have to undo the 'minus >>>one' part to implement plain exp(). It might be as simple as [...] >> >>...yes, it is that simple, and here's a clean-room 'not-a-patch' >>that should make it easy to implement without copyright or >>license issues: >> >>// Make a copy of mingwex/math/expl.c . >>// >>// Change the function name (I happened to use 'NEW_FUNCTION'). >>// >>// The original function uses an asm instruction that already >>// calculates expm1(), which is what we want; then it adds one, >>// which is not what we want, so get rid of the code that adds one. >>// >>// The inline-asm function should be used only within its domain of >>// (-.5*M_LN2, +.5*M_LN2) >>// A cover function ought to test whether its argument is outside >>// that domain and, if it is, simply call exp() and return its >>// result minus one. > > If we restrict domain of an our asm __expm1 to (-.5*M_LN2, +.5*M_LN2), than much > of the code > in exp() is really unnecessary. We don't need to worry about the integral part > of the separaton > > x log2(e) = i + f, |f| <= .5 You're right. I was trying to change as little as possible in order to avoid FSF issues, but this evening I remembered that mingwex isn't part of the GNU project. I'll rewrite patch 1109674 to reflect your suggestion, which will save some cycles as well as making things clearer. I think the domain can be made twice as broad, too. |