Provides standard math functions.
The following statement may be used to import the math library:
import math;| Name | Description |
|---|---|
| seed_random | Seed the random number generator using system time |
| get_random | Get a random integer |
| int_to_double | Convert an integer to a double |
| double_to_int | Convert a double to an integer |
| int_to_long | Convert an integer to a long |
| long_to_int | Convert a long to an integer |
| long_to_double | Convert a long to a double |
| double_to_long | Convert a double to a long |
| absolute_value | Convert an integer, long, or double to its absolute value |
| sqrt | Get the square root of an integer, long, or double |
| log10 | Get the common logarithm an integer, long, or double |
| ceil | Get the least value not less than an integer, long, or double |
| round | Get the nearest integer, long, or double |
| floor | Get theleast of an integer, long, or double |
| sin | Compute the sine of an integer, long, or double |
| cos | Compute the cosine of an integer, long, or double |
| tan | Compute the tangent of an integer, long, or double |
| get_pi | Returns pi approximation 3.141592653589793 |
| set_precision | Set the fixed standard output precision |
| exp | Computes Euler's number raised to the given integer, long, or double |
call seed_random;int rand;
call get_random -> rand;int iToD = 5;
double tempDouble;
call int_to_double : iToD -> tempDouble;int dToI = -1;
double tempDouble;
call double_to_int : tempDouble -> dToI;int toLong = 12345;
long l;
call int_to_long : toLong -> l;long toInt = 349674032692;
int i;
call long_to_int : toInt -> i;long toDouble = 122334;
double d;
call long_to_double : toDouble -> d;double toLong = 3.14;
long l;
call double_to_long : toLong -> l;double toLong = -3.14;
long l;
call absolute_value : toLong -> l;double value = 4;
double l;
call sqrt : value -> l;double value = 100;
double l;
call log10 : value -> l;double value = 100.5;
double l;
call ceil : value -> l;double value = 100.5;
double l;
call round : value -> l;double value = 100.5;
double l;
call floor : value -> l;double value = 100;
double l;
call sin : value -> l;double value = 100;
double l;
call cos : value -> l;double value = 100;
double l;
call tan : value -> l;double pi_val = 0;
call get_pi -> pi_val;int precision = 17;
call set_precision : precision;double val = 1.6;
call exp : val -> val;