Transcendental approximations

Status
Not open for further replies.

josh_

Newbie level 6
Joined
Sep 27, 2004
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
136
Hi all,

I'm looking to do some simple low-level approximations of sin, atan, 2^x, and log2 x for a CPU I'm making. So far I've got a simplified MacLaurin polynomial
for sine, which seems to produce quite a good result (8 terms --> 16 decimal place accuracy at pi/2, 16 terms --> 41 dec. place, 24 terms --> 64 dec. place) with no powers past 2 and no factorials.
For arctangent, I have a similar MacLaurin polynomial, but it degenerates quickly past pi/12. Any ideas?

As far as 2^x and log2 go, I'm in the dark. Any hints would be appreciated.

Thanks!
-- Josh
 

2^x should be very simple if you are working in binary. Just notice
2^0=0
2^1=10
2^2=100...

As far as log_2(x) is concerned, I'll refer you to Feynman's method. Look in the section "An Algorithm For Logarithms" in (and you can pick up on that)
**broken link removed**

I hope that helps...
Chirkut
 

chirkut_iis said:
2^x should be very simple if you are working in binary. Just notice
2^0=0
2^1=10
2^2=100...
Yes, but 2^3.14159 is...?
Remember, this is floating-point. Sorry if I wasn't clear on that.


Great, I'll look into the log2 link. Thanks!

-- Josh

P.S. Anyone know how to do a good approximation to arctangent?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…