Number Functions and Properties

In this Page

toExponential

Description

Returns a string representing the Number object in exponential notation.

This is similar to the JavaScript .toExponential().

Syntax
object.toExponential(optdigits)

where optdigits is an optional integer to specify the number of digits to appear after the decimal point.

Example

Expression: Math.random().toExponential()

Result: 7.650264534953171e-1


Expression: Math.random().toExponential(2)

Result: 7.65e-1

toFixed

Description

Returns a string representing the Number object using fixed-point notation.

This is similar to the JavaScript .toFixed().

Syntax
object.toFixed(optdigits)

where optdigits is an optional integer to specify the number of digits to appear after the decimal point.

Example

Expression: $Number.toFixed()

Result: If $Number is equal to 0.89473, the result is 1.

toPrecision

Description

Returns a string representing the Number object to the specified precision.

This is similar to the JavaScript .toPrecision().

Syntax
object.toPrecision(number)
Example

Expression: $Number.toPrecision(2)

Result: If $Number is equal to 4.2103, the result is 4.2.

  • If a value precision is omitted, the number is converted to a string.