613-518-1166 info@zimdatabases.com

ZIM Language Reference

$tonumber

< All Topics

$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.

 

See Also

$money

$round

$toalpha

$tocharacter

About Functional Expressions

Decimals and Rounding

Decimals in Functional Expressions

Number Literals

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents