Skip to content

Math

std:math are functions that operate on numbers.

Functions

random (min?, max?)

Returns a random number between that operate on numbers.

import "std:math";
 
print(random(1, 10));
 
Console; 
1.223244224; 

round ( number )

Round the given number to the nearest integer.

import "std:math";
 
print(round(1.7));
 
Console; 
2; 

floor ( number )

Given a number, return the largest integer less than or equal to the number.

import "std:math";
 
print(floor(1.7));
 
Console; 
1; 

ceil ( number )

Given a number, return the smallest integer greater than or equal to the number.

import "std:math";
 
print(ceil(1.7));
 
Console; 
2; 

abs ( number )

Given a number, return the absolute value of the number.

import "std:math";
 
print(abs(-1.7));
 
Console; 
1.7; 

sqrt ( number )

Given a number, return the square root of the number.

import "std:math";
 
print(sqrt(9));
 
Console; 
3;