Numbers and Math
Arithmetic, rounding, trigonometry, random numbers, bit operations and number formatting.
Arithmetic, rounding, trigonometry, random numbers, bit operations and number formatting. 43 entries. This page is generated from the MatchBox source; see the function reference index for how to read the tables and what each gate means.
| Function | Forms | Gate | Notes |
|---|---|---|---|
abs | abs( number ), number.abs() | always | Returns the absolute value. Defined in the prelude and as a native function; the prelude definition is the one that runs. |
acos | acos( ... ), number.acos( ... ) | always | |
asin | asin( ... ), number.asin( ... ) | always | |
atan | atan( ... ), number.atan( ... ), number.atn( ... ) | always | |
atan2 | atan2( ... ) | always | |
atn | atn( ... ) | always | |
bitAnd | bitAnd( ... ) | always | Bitwise AND. |
bitMaskClear | bitMaskClear( ... ) | always | |
bitMaskRead | bitMaskRead( ... ) | always | |
bitMaskSet | bitMaskSet( ... ) | always | |
bitNot | bitNot( ... ) | always | Bitwise NOT. |
bitOr | bitOr( ... ) | always | Bitwise OR. |
bitSh | bitSh( ... ) | always | |
bitShln | bitShln( ... ) | always | Shifts bits left by n positions. |
bitShrn | bitShrn( ... ) | always | Shifts bits right by n positions. |
bitXor | bitXor( ... ) | always | Bitwise XOR. |
ceiling | ceiling( ... ), number.ceiling( ... ) | always | Rounds up to an integer. |
cos | cos( ... ), number.cos( ... ) | always | |
decimalFormat | decimalFormat( ... ), number.decimalFormat( ... ) | always | |
decrementValue | decrementValue( ... ), number.decrementValue( ... ) | always | Subtracts 1. |
exp | exp( ... ), number.exp( ... ) | always | Returns e raised to a power. |
fix | fix( ... ), number.fix( ... ) | always | Removes the fractional part (rounds toward zero). |
floor | floor( ... ), number.floor( ... ) | always | Rounds down to an integer. |
formatBaseN | formatBaseN( ... ) | always | Converts a number to a string in the given base. |
incrementValue | incrementValue( ... ), number.incrementValue( ... ) | always | Adds 1. |
inputBaseN | inputBaseN( ... ) | always | Parses a string in the given base. |
int | int( ... ), number.int( ... ) | always | |
log | log( ... ), number.log( ... ) | always | |
log10 | log10( ... ), number.log10( ... ) | always | Returns the base-10 logarithm. |
max | max( n1, n2 ) | always | Returns the larger of two numbers. Defined in the prelude and as a native function; the prelude definition is the one that runs. |
min | min( n1, n2 ) | always | Returns the smaller of two numbers. Defined in the prelude and as a native function; the prelude definition is the one that runs. |
numberFormat | numberFormat( ... ), number.numberFormat( ... ) | always | Formats a number with a mask such as "9,999.99". |
pi | pi( ... ) | always | Returns pi. |
precisionEvaluate | precisionEvaluate( ... ) | always | |
rand | rand( ... ) | always | Returns a random number from 0 up to, but not including, 1. |
randomize | randomize( ... ) | always | |
randRange | randRange( ... ) | always | Returns a random integer between two bounds, inclusive. |
round | round( ... ), number.round( ... ) | always | Rounds to the nearest integer, or to the given number of decimals. |
sgn | sgn( ... ), number.sgn( ... ) | always | Returns -1, 0 or 1 for the sign of a number. |
sin | sin( ... ), number.sin( ... ) | always | |
sqr | sqr( ... ), number.sqr( ... ) | always | Returns the square root. |
tan | tan( ... ), number.tan( ... ) | always | |
val | val( ... ), string.val( ... ) | always | Parses the leading number of a string, 0 when there is none. |