$tonumber

Converts a value into its numeric equivalent.

Syntax

$tonumber(expression,decimals)

Parameters

expression

Any value, or an expression that yields any value.

decimals

A number specifying the number of decimal places required in the converted value. Decimals can be negative.

Return Value

Number equivalent of expression.

Comments

Use $tonumber to obtain the numeric equivalent of expression. If decimals is negative, the implicit number of decimal places in expression is used.

Example

$tonumber(1.273,2)

Evaluates to 1.27.

$tonumber(16/6,3)

Evaluates to 2.667.

$tonumber("2345",2)

Evaluates to 2345.00.

$tonumber("Smith",5)

Evaluates to 0.00000 (and produces an error).

$tonumber("1.2"*1.20,-1)

Evaluates to 1.44.

 

Related Topics