NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
ex_asin.nxc

This is an example of how to use the asin function.

// ex_asin.nxc
// Display values of the asin 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_asin(const float val, const int screen_y)
{
TextOut(0, screen_y, FormatNum("%7.4f RAD", asin(val)));
}
task main()
{
show_asin(MIN_VAL, LCD_LINE1); // shows -1.5708 RAD
show_asin(MID_VAL, LCD_LINE2); // shows 0.0000 RAD
show_asin(MAX_VAL, LCD_LINE3); // shows 1.5708 RAD
// An invalid value returns not-a-number (nan).
show_asin(INVALID, LCD_LINE4); // shows -nan RAD
while (true);
}