Skip to content

Latest commit

 

History

History
105 lines (72 loc) · 1.93 KB

math_library.md

File metadata and controls

105 lines (72 loc) · 1.93 KB

Home Standard library

Math library

Provides standard math functions.

Import

The following statement may be used to import the math library:

import math;

Functions

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 a integer, long, or double to its absolute value

Examples

seed_random

call seed_random;

get_random

int rand;
call get_random -> rand;

int_to_double

int iToD = 5;
double tempDouble;

call int_to_double : iToD -> tempDouble;

double_to_int

int dToI = -1;
double tempDouble;

call double_to_int : tempDouble -> dToI;

int_to_long

int toLong = 12345;
long l;

call int_to_long : toLong -> l;

long_to_int

long toInt = 349674032692;
int i;

call long_to_int : toInt -> i;

long_to_double

long toDouble = 122334;
double d;

call long_to_double : toDouble -> d;

double_to_long

double toLong = 3.14;
long l;

call double_to_long : toLong -> l;

absolute_value

double toLong = -3.14;
long l;

call absolute_value : toLong -> l;