Math

◷ Reading Time: 4 minutes

min

Returns the smallest of two numbers.

 min (value1, value2)
  • value1 (Numeric): First value to be compared (Mandatory)
  • value2 (Numeric): Second value to be compared (Mandatory)
Example: min (100, 50)
Result: 50
Example: min (0.1, -2.50)
Result: -2.5
Example: min (0.56, 3.20)
Result: 0.56 

max

Returns the largest of two numbers.

 max (value1, value2)
  • value1 (Numeric): First value to be compared (Mandatory)
  • value2 (Numeric): Second value to be compared (Mandatory)
Example: max (100, 50)
Result: 100
Example: max (0.1, -2.50)
Result: 0.1
Example: max (0.56, 3.20)
Result: 3.2 

floor

Returns the largest integer less than or equal to the specified number.

 floor (value)
  • value (Decimal Number): Any number with a floating point (i.e. float, decimal, double, long). Integer values are not accepted. (Mandatory)
Example: floor (100.56)
Result: 100
Example: floor (-2.10)
Result: -3
Example: floor (1.0)
Result: 1

round

Rounds a numeric value to the nearest integral or decimal value.

 round (value, decimals)
  • value (Numeric): Number to be rounded (Mantatory)
  • decimals (Integer): Numbers of required decimal to be round to (Optional)
Example: round (23.4567, 2)
Result: 23.46 
Example: round (-23.4567, 3)
Result: -23.457 
Example: round (23.567)
Result: 24 

ceiling

Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number.

 ceiling (value)
  • value (Numeric): Any number (i.e. float, decimal, double, long, in). (Mandatory)
Example: ceiling (100.56)
Result: 101
Example: ceiling (-2.10)
Result: -2
Example: ceiling (1)
Result: 1

log

Returns the natural (or other bases for) logarithm of a specified number.

 log (value, base)
  • value (Numeric): The number to calculate log (Mandatory)
  • base (Numeric): Base for the log. Default is e (Optional)
Example: log (5, 10)
Result: 0.69897000433601875
Example: log (1024, 2)
Result: 10
Example: log (27, 3)
Result: 3

abs

Returns the absolute value of a double-precision floating-point number.

 abs (value)
  • value (Numeric): The number to calculate log (Mandatory)
Example: abs (-10)
Result: 10
Example: abs (-0.2)
Result: 0.2
Example: abs (32)
Result: 32

range

Generates and returns a sequence of integral numbers within a specified range.

 range (start, count)
  • start (Numeric): Value of the first integer in the sequence (Mandatory)
  • count (Numeric): Number of sequential integers to generate (Mandatory)
Example: range (2, 5)
Result: [2, 3, 4, 5, 6] 

This generates 5 numbers starting from 2. 
Example: range (-3, 7)
Result: [-3, -2, -1, 0, 1, 2, 3]

This generates 7 numbers starting from -3. 

rand

Generates and returns a random number within a specified range.

This function uses secure random generator.

If you don’t specify any parameters, it will generate a decimal value between 0 and 1.

 rand (minimum, maximum, seed)
  • minimum (Numeric): Value of the first integer in the sequence
  • maximum (Numeric): the number of sequential integers to generate
  • seed (Numeric): If you want to generate the same random number every time within the given minimum and maximum range
Example: rand (3, 10)
Result: 8  

This generates a random number between 3 amd 10. 
Example: rand ()
Result: 0.444317978548034  

This generates a random decimal value between 0 and 1. 
Example: rand (3, 10, 6)
Result: 9

This generates the same random number between 3 amd 10.
Example: rand (-20, -10)
Result: -11

This generates a random number between -20 amd -10.

Updated on November 29, 2022

Was this article helpful?

Related Articles