COS/SIN/TAN Source

Looking for source for the basic cos/sin/tan functions.

Looked in lots of APIs header files and found reference to these in math.h several times but not the actual code.

Anyone know where I can find a copy of some source for the actual functions?

Regards
Gary
closed account (o1vk4iN6)
They most likely use the FPU for sin/cos/tan which has the functions built in.
Last edited on
What do you mean, sorry?

Is there not just source for a function that can be read?
Last edited on
FPU is "Floating Point Unit". And on an x87 FPU, I think there's an instruction called fsin, (and another called fcos) which can find the sine and cosine of angles. I'm sure cmath or math.h use those internally usually, but I'm not completely sure.
Just last clarification: the fact that it's an FPU instruction means it is done in hardware, like with transistors :) So there will be no explicit code for that in standard library.

I think you may find the code you look for if you search for something like "cos c++ Taylor series" - it may be out there somewhere.
Topic archived. No new replies allowed.