Trigonometry Library
The mikroBasic PRO for dsPIC30/33 and PIC24 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 |
sub function sinE3(dim angle_deg as word) as integer |
---|---|
Description |
The function calculates sine multiplied by 1000 and rounded to the nearest integer:
result = round(sin(angle_deg)*1000)
|
Parameters |
|
Returns |
The function returns the sine of input parameter multiplied by 1000. |
Requires |
Nothing. |
Example |
dim res as integer ... res = sinE3(45) ' result is 707 |
Notes |
Return value range: |
cosE3
Prototype |
sub function cosE3(dim angle_deg as word) as integer |
---|---|
Description |
The function calculates cosine multiplied by 1000 and rounded to the nearest integer:
result = round(cos(angle_deg)*1000)
|
Parameters |
|
Returns |
The function returns the cosine of input parameter multiplied by 1000. |
Requires |
Nothing. |
Example |
dim res as integer ... res = cosE3(196) ' result is -193 |
Notes |
Return value range: |
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
What do you think about this topic ? Send us feedback!