Numerical Display Functions
The following list includes both WebAssignspecific and commonlyused Perl functions that are available when creating questions.
Rounding, Significant Digits, Scientific Notation
Operation 
Usage 
Notes 

Round to specified decimal places 

Returns n rounded to the specified number of decimal places. 
Round up (next greater integer) 

Returns the first integer greater than n, for example, ceil(23.2) is 24, ceil(23.7) is 23. 
Round down (next lesser integer) 

Returns the first integer less than n, for example, floor(23.7) is 23, floor(23.2) is  24. 
Return integer only 

Returns only the integer component of n, for example, int(23.7) is 23, int(23.2) is  23. 
Get significant digits 

Returns the number of significant digits in n, ignoring trailing zeros. 
Display significant digits 

Returns n rounded to the specified number of significant digits. Uses "e" notation if needed, for example, 2.30e+04. 
Get decimal places 

Returns a power of 10 that represents the smallest significant decimal place in n. Ignores trailing zeros. 
Display scientific notation 

Returns n formatted as scientific notation with the specified number of significant digits, for example 2.31 × 10^{4}. Do not use results for additional computation. 
Display "e" notation 

Returns n in "e" notation with up to the specified number of significant digits after the decimal point, for example 2.31e+04. 
Display of Numerical Values
The listed functions are mostly used in Question or Solution to format values for display.
Operation 
Usage 
Notes 

Reduced fraction 

Returns the fraction n/d in reduced form, for
example, 1/2 or 1. If used in Answer, specify

Rounded integer 

Returns n rounded to the nearest integer. Uses "e" notation when n ≥ 1e+05. 
Add commas 

Returns n with commas between digit groups to the left of the decimal point, for example, 12,345.678901. Do not use results for additional computation. 
Add spaces 

Returns n with spaces between digit groups on both sides of the decimal point, for example, 12 345.678 901. Do not use results for additional computation. 
Display as words 

Returns the integer part of n in words, for example, "negative twentythree". Does not add commas. 
Display as words (ordinal) 

Returns the integer part of n as an ordinal number in words, for example, "thirteenth". Does not add commas. 