|
|
- NAME
- #include <aros/libcall.h>
#include <proto/mathieeesingbas.h>
#include <proto/mathieeesingtrans.h>
#include <proto/exec.h>
#include <exec/types.h>
#include <libraries/mathieeesp.h>
float IEEESPCos ()
- SYNOPSIS
- float y
- FUNCTION
- Calculate the cosine of a given IEEE single precision number in radians
- INPUTS
- y
- IEEE single precision floating point number
- RESULT
- IEEE single precision floating point number
flags:
zero : result is zero
negative : result is negative
overflow : 0
- NOTES
-
- EXAMPLE
- BUGS
-
- SEE ALSO
- MathIEEESingleTrans
- INTERNALS
- Algorithm for Calculation of cos(y):
z = floor ( |y| / pi );
y_1 = |y| - z * pi; => 0 <= y_1 < pi
if (y_1 > pi/2 ) then y_1 = pi - y_1;
=> 0 <= y_1 < pi/2
Res = 1 - y^2/2! + y^4/4! - y^6/6! + y^8/8! - y^10/10! =
= 1 -(y^2(-1/2!+y^2(1/4!+y^2(-1/6!+y^2(1/8!-1/10!y^2)))));
if (z was an odd number)
Res = -Res;
if (y_1 was greater than pi/2 in the test above)
Res = -Res;
|