FX_CosIdx


C Specification

#include <nitro/fx/fx_trig.h>

fx16 FX_CosIdx( int idx );

Description

The argument equates 1 to the value of 2π radian divided by 65,536. The function returns the result as an fx16 type 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 of the int type. 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 be masked by 0xffff.

Arguments

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

Return Values

Approximation of the cosine.

See Also

FX_SinIdx, FX_SinFx64c, FX_CosFx64c

Revision History

06/16/2004 Initial Version