mikroC

making it simple...

Trigonometry Library

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC implements fundamental trigonometry functions. These functions are implemented as lookup tables, and return the result as integer, multiplied by 1000 and rounded up.

Library Routines

 

SinE3

 

 

CosE3

 

SinE3

 

 

 

 

Prototype

int SinE3(unsigned angle_deg);

 

 

Returns

Function returns the sine of input parameter, multiplied by 1000 (1E3) and rounded up

 

to the nearest integer. The range of return values is from -1000 to 1000.

 

 

Description

Function takes parameter angle_deg which represents angle in degrees, and returns its

 

sine multiplied by 1000 and rounded up to the nearest integer. The function is imple-

 

mented as a lookup table; maximum error obtained is ±1.

 

 

 

Example

res = SinE3(45);

// result is 707

 

 

 

CosE3

 

 

 

 

Prototype

int CosE3(unsigned angle_deg);

 

 

Returns

Function returns the cosine of input parameter, multiplied by 1000 (1E3) and rounded

 

up to the nearest integer. The range of return values is from -1000 to 1000.

 

 

Description

Function takes parameter angle_deg which represents angle in degrees, and returns its

 

cosine multiplied by 1000 and rounded up to the nearest integer. The function is imple-

 

mented as a lookup table; maximum error obtained is ±1.

 

 

 

Example

res = CosE3(196);

// result is -193

 

 

 

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

303