Advertisement

Trigonometric functions?

Started by September 18, 2000 08:54 AM
2 comments, last by Ksero 24 years, 3 months ago
I was just wondering... Does anyone know how computers and calculators handle sine, cosine and such functions? I mean, how does the computer calculate that sine(0.5)=0.4794..... Does it have a table and just look it up? or is there some ingenious equation for calculating the values? And while I''m at it, how fast are they? //Ksero
I don''t know the exact spec but for sine and cosine, I think they derive the values from the equation of a circle. As for how fast they are, well you could always benchmark them. I''d say probably twice as fast as a square root call.
Advertisement
Okay, I don''t know how they do it either, but I was skeptical of NBGH response. So looking at the Pentium Developers Manual from Intel a fcos takes 18-124 cycles, a fsin 16-126, and a sqrt 70.

I would guess that the computer uses the taylor series expansion to get sin and cos values. but just a guess.
Yes, it is the Taylor series I think. If it was a lookup table it would be much faster than it is.

------------------------------
#pragma twice


sharewaregames.20m.com

This topic is closed to new replies.

Advertisement