| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| "cyrille de brebisson" <cyrille@hp.com> wrote in message news:g3rnco$eut$1@usenet01.boi.hp.com... > I am trying to understand how computers calcualte exp and ln. > > can someone point me toward a nice website that explains all that? or at > least give me the name of the algorithm (basically the exp/ln equivalent of > CORDIC for trig)? Power series can be used for these operations. log(1+x) = x - x*x/2 + x**3/3 - x**4/4 + ... for |x| < 1. exp(x) = 1 + x + x**2/2 + x**3/3! + x**4/4! + ... Algorithms in software libraries often use specific approximation formulas tailored to the accuracy that a particular machine can deliver. Such formulas are typically quicker than using a power series. Illustration in PL/I using power series: TEST: PROCEDURE OPTIONS (MAIN); declare (s, t, x) float; declare n fixed binary; get (x); s, t = 1; do n = 1 to 20; t = t * x / n; s = s + t; end; put (s); END TEST; In practice, if this were used, a different method would be used to terminate the loop. |
|
#2
| |||
| |||
| "cyrille de brebisson" <cyrille@hp.com> wrote in message news:g3rnco$eut$1@usenet01.boi.hp.com... >I am trying to understand how computers calcualte exp and ln. There is probably one, but it is usual to do it based on the floating point representation. In a base 2 floating point system, the internal representation has a binary number multiplied by some power of two. See: http://en.wikipedia.org/wiki/Talk:Ex...9_in_computers -- glen |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.