NXC
Version 1.2.1 r5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
All
Data Structures
Files
Functions
Variables
Groups
Pages
ex_acosd.nxc
This is an example of how to use the
acosd
function.
// ex_acosd.nxc
// Display values of the acosd API call.
// This program runs indefinitely -- press gray button to exit.
// Reguires enhanced firmware 1.28 or later.
#define MIN_VAL -1.0
#define MID_VAL 0.0
#define MAX_VAL 1.0
#define INVALID 2.0
inline
void
show_acos(
const
float
val,
const
int
screen_y)
{
TextOut
(0, screen_y,
FormatNum
(
"%6.2f DEG"
,
acosd
(val)));
}
task main()
{
show_acos(MIN_VAL,
LCD_LINE1
);
// shows 180.00 DEG
show_acos(MID_VAL,
LCD_LINE2
);
// shows 90.00 DEG
show_acos(MAX_VAL,
LCD_LINE3
);
// shows 0.00 DEG
// An invalid value returns not-a-number (nan).
show_acos(INVALID,
LCD_LINE4
);
// shows -nan DEG
while
(
true
);
}
Generated by
1.8.2