Re: Fast exponent and logarithm, given initial estimate
From: Glen Low (glenlow_at_pixelglow.com)
Date: 10/20/04
- Next message: hh: "help for numerical solution of simple first order PDE"
- Previous message: MM: "Re: Simplification in Maple"
- In reply to: Gert Van den Eynde: "Re: Fast exponent and logarithm, given initial estimate"
- Next in thread: Richard Mathar: "Re: Fast exponent and logarithm, given initial estimate"
- Reply: Richard Mathar: "Re: Fast exponent and logarithm, given initial estimate"
- Reply: Gert Van den Eynde: "Re: Fast exponent and logarithm, given initial estimate"
- Messages sorted by: [ date ] [ thread ]
Date: 20 Oct 2004 07:48:08 -0700
> just my 2 cents
>
> be X the number you want the exp(X) for
> the idea is to reduce the interval for X to [0,ln(2)]
>
> 1) rewrite exp(X) as 2^p * exp(x)
> do this by multiplying X by log_2(e)
> the integer part of this is p. Calculate x by x = X - p ln(2)
>
> so the problem is reduced to an approximation for x in [0,ln(2)] and once we
> have this, multiply by 2^p which can be done quite quickly and without
> error.
Yes I figured that out already. The Altivec exp estimate can calculate
the 2^p accurately for me.
> 2) approximate exp(x) in [0,ln(2)] by a minimax-approximation:
>
> the next is a 6th degree polynomial minimax-approximation which has a
> relative error < 10e-8 in the interval [0,ln(2)]. Coefficients are from a_0
> to a_6 where a_i belongs to x**i.
>
> 1.000000002644271861135635165803
> 0.999999630676466160313515392503
> 0.500008415450545865703228178366
> 0.166594937239279108432157593360
> 0.041956255273539448094181805064
> 0.007740059180886275586488149490
> 0.001973684356346945984956068724
That was brilliant! I plugged in the coefficients into the polynomial,
and the results were within 5 ulps of the library exp. (I had weird
rounding errors when I used squaring reduction and Taylor polynomials
and straightforward Horner-style factoring, so you've saved me tearing
the last bits of my hair out.) All within 9 multiplies.
Now to slice off one more multiply by using the Knuthean polynomial
transform suggested by a post in a different part of this thread...
Qn: what tool did you use to generate the minimax polynomial?
Cheers,
Glen Low, Pixelglow Software
www.pixelglow.com
- Next message: hh: "help for numerical solution of simple first order PDE"
- Previous message: MM: "Re: Simplification in Maple"
- In reply to: Gert Van den Eynde: "Re: Fast exponent and logarithm, given initial estimate"
- Next in thread: Richard Mathar: "Re: Fast exponent and logarithm, given initial estimate"
- Reply: Richard Mathar: "Re: Fast exponent and logarithm, given initial estimate"
- Reply: Gert Van den Eynde: "Re: Fast exponent and logarithm, given initial estimate"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|