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.

FunctionFormsGateNotes
absabs( number ), number.abs()alwaysReturns the absolute value. Defined in the prelude and as a native function; the prelude definition is the one that runs.
acosacos( ... ), number.acos( ... )always
asinasin( ... ), number.asin( ... )always
atanatan( ... ), number.atan( ... ), number.atn( ... )always
atan2atan2( ... )always
atnatn( ... )always
bitAndbitAnd( ... )alwaysBitwise AND.
bitMaskClearbitMaskClear( ... )always
bitMaskReadbitMaskRead( ... )always
bitMaskSetbitMaskSet( ... )always
bitNotbitNot( ... )alwaysBitwise NOT.
bitOrbitOr( ... )alwaysBitwise OR.
bitShbitSh( ... )always
bitShlnbitShln( ... )alwaysShifts bits left by n positions.
bitShrnbitShrn( ... )alwaysShifts bits right by n positions.
bitXorbitXor( ... )alwaysBitwise XOR.
ceilingceiling( ... ), number.ceiling( ... )alwaysRounds up to an integer.
coscos( ... ), number.cos( ... )always
decimalFormatdecimalFormat( ... ), number.decimalFormat( ... )always
decrementValuedecrementValue( ... ), number.decrementValue( ... )alwaysSubtracts 1.
expexp( ... ), number.exp( ... )alwaysReturns e raised to a power.
fixfix( ... ), number.fix( ... )alwaysRemoves the fractional part (rounds toward zero).
floorfloor( ... ), number.floor( ... )alwaysRounds down to an integer.
formatBaseNformatBaseN( ... )alwaysConverts a number to a string in the given base.
incrementValueincrementValue( ... ), number.incrementValue( ... )alwaysAdds 1.
inputBaseNinputBaseN( ... )alwaysParses a string in the given base.
intint( ... ), number.int( ... )always
loglog( ... ), number.log( ... )always
log10log10( ... ), number.log10( ... )alwaysReturns the base-10 logarithm.
maxmax( n1, n2 )alwaysReturns the larger of two numbers. Defined in the prelude and as a native function; the prelude definition is the one that runs.
minmin( n1, n2 )alwaysReturns the smaller of two numbers. Defined in the prelude and as a native function; the prelude definition is the one that runs.
numberFormatnumberFormat( ... ), number.numberFormat( ... )alwaysFormats a number with a mask such as "9,999.99".
pipi( ... )alwaysReturns pi.
precisionEvaluateprecisionEvaluate( ... )always
randrand( ... )alwaysReturns a random number from 0 up to, but not including, 1.
randomizerandomize( ... )always
randRangerandRange( ... )alwaysReturns a random integer between two bounds, inclusive.
roundround( ... ), number.round( ... )alwaysRounds to the nearest integer, or to the given number of decimals.
sgnsgn( ... ), number.sgn( ... )alwaysReturns -1, 0 or 1 for the sign of a number.
sinsin( ... ), number.sin( ... )always
sqrsqr( ... ), number.sqr( ... )alwaysReturns the square root.
tantan( ... ), number.tan( ... )always
valval( ... ), string.val( ... )alwaysParses the leading number of a string, 0 when there is none.
Edit this page Download Markdown Last updated Oct 27, 2026, 1:45:34 PM Report an issue