Thanks for the pointer. I see that these functions are now called expm1 and log1p, and are available in many (but sadly not all) math libraries and languages, and people know enough to complain when they're not present. Were I still writing PostScript clones, I'd make sure to include them, even though it wouldn't be quite Adobe compatible. --ms -----Original Message----- From: Henry Baker [mailto:hbaker1@pipeline.com] Sent: Saturday, August 02, 2008 10:39 To: ms@alum.mit.edu; math-fun Subject: Re: [math-fun] floating point precision and hyperbolic functions You are correct! However, Apple's original "SANE" library, on which Kahan consulted (I believe), _did_ have exp1(x) & log1(x), because without them, it is nearly impossible to get decent results when computing compound interest. http://developer.apple.com/documentation/mac/PPCNumerics/PPCNumerics-168.htm l I believe that Kahan also consulted on the Intel 80387 floating point coprocessor, which I believe also has these two functions. The sad part is that these two functions haven't made it into high school curricula, so that students can learn a little about numerical analysis. At 07:15 PM 8/1/2008, Mike Speciner wrote:
But I wondered why the standard floating point math libraries (at least the ones I know about) don't provide exp(x)-1 and ln(1+x). Each of these functions is approximately x for small x, and so would avoid the loss of precision when adding 1 to a small number. (If one already has hyperbolic functions, then I suppose exp(x)-1 = sinh(x) (1 + sinh(x)/(cosh(x)+1)), and log(1+x) = 2 atanh(x/(2+x)).)
--ms