Trigonometry library, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 311

Advertising
background image

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

SinE3

CosE3

MikroElektronika: Development tools - Books - Compilers

303

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Trigonometry Library

Library Routines

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

SinE3

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

CosE3

Advertising
This manual is related to the following products: