Trigonometry Library

The mikroPascal PRO for 8051 implements fundamental trigonometry functions. These functions are implemented as look-up tables. Trigonometry functions are implemented in integer format in order to save memory.

Library Routines

sinE3

Prototype

function sinE3(angle_deg : word): integer;

Returns

The function returns the sine of input parameter.

Description

The function calculates sine multiplied by 1000 and rounded to the nearest integer:

result := round(sin(angle_deg)*1000)

Parameters:

  • angle_deg: input angle in degrees

  Note : Return value range: -1000..1000
Requires

Nothing.

Example
var res : integer;
...
res := sinE3(45);  // result is 707

cosE3

Prototype

function cosE3(angle_deg : word): integer;

Returns

The function returns the cosine of input parameter.

Description

The function calculates cosine multiplied by 1000 and rounded to the nearest integer:

result := round(cos(angle_deg)*1000)

Parameters:

  • angle_deg: input angle in degrees

  Note : Return value range: -1000..1000.
Requires

Nothing.

Example
var res: integer;
...
res := cosE3(196);  // result is -961
Copyright (c) 2002-2013 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code