FX_CosIdx

C Specification

#include <nitro/fx/fx_trig.h>

fx16 FX_CosIdx( int idx );

Arguments

idx The number of units with a value of 2π radians divided by 65536.

Return Values

Approximation of the cosine.

Description

The argument equates 1 to the value of 2π radian divided by 65,536. It returns the result as an fx16 type. It is based on a lookup in an internal 4,096-element table. Be aware that the error will become very large near 0.5π and 1.5π. The argument must take a value between 0 - 65535.

The argument is the int type, so in order to make the negative numbers and the numbers larger than 65536 to wrap around to be between 0 and 65536, it needs to be cast explicitly to an u16 type or masked by 0xffff.

See Also

FX_SinIdx, FX_SinFx64c, FX_CosFx64c

Revision History

06/16/2004 Initial version.