Access Keys:
Skip to content (Access Key - 0)
iServoy.com | Servoy.com | Forum index | Store | Developers | Documentation | Events | Products | Support

Number

All versions
Click for all versions
Servoy 5.0.x
Toggle Sidebar
This documentation relates to an earlier version of Servoy
View this page in the current documentation or visit the current documentation home.

\\
Property Summary
NumberMAX_VALUE
The largest representable number.
NumberMIN_VALUE
The smallest representable number.
NumberNEGATIVE_INFINITY
Special value representing negative infinity; returned on overflow.
ObjectNaN
Special "not a number" value.
NumberPOSITIVE_INFINITY
Special value representing infinity; returned on overflow.
\\
Method Summary
StringtoExponential(fractionDigits)
Returns a string representing the number in exponential notation.
StringtoFixed(digits)
Returns a string representing the number in fixed-point notation.
StringtoPrecision(precision)
Returns a string representing the number to a specified precision in fixed-point or exponential notation.
\\
Property Details
MAX_VALUE

The largest representable number.

Returns

Number

Sample
application.output("Largest number: " + Number.MAX_VALUE);
MIN_VALUE

The smallest representable number.

Returns

Number

Sample
application.output("Smallest number: " + Number.MIN_VALUE);
NEGATIVE_INFINITY

Special value representing negative infinity; returned on overflow.

Returns

Number

Sample
application.output("Negative infinity: " + Number.NEGATIVE_INFINITY);
NaN

Special "not a number" value.

Returns

Object

Sample
application.output("NaN: " + Number.NaN);
POSITIVE_INFINITY

Special value representing infinity; returned on overflow.

Returns

Number

Sample
application.output("Positive infinity: " + Number.POSITIVE_INFINITY);

Method Details
toExponential
StringtoExponential(fractionDigits)

Returns a string representing the number in exponential notation.

Parameters

[fractionDigits] – An integer specifying the number of digits after the decimal point. Defaults to as many digits as necessary to specify the number.

Returns

String – A string representing the number in exponential notation.

Sample
var n = 123.45678;
application.output(n.toExponential(3));
toFixed
StringtoFixed(digits)

Returns a string representing the number in fixed-point notation.

Parameters

[digits] – The number of digits to appear after the decimal point. Defaults to 0.

Returns

String – A string representing the number in fixed-point notation.

Sample
var n = 123.45678;
application.output(n.toFixed(3));
toPrecision
StringtoPrecision(precision)

Returns a string representing the number to a specified precision in fixed-point or exponential notation.

Parameters

[precision] – An integer specifying the number of significant digits.

Returns

String – A string representing the number to a specified precision in fixed-point or exponential notation.

Sample
var n = 123.45678;
application.output(n.toPrecision(5));

Visit our website at http://www.servoy.com or read our blogs at http://www.servoy.com/blog
Powered by Atlassian Confluence (w/ Adaptavist Theme Builder) | Terms of Use | Privacy Policy