The Numeric Class

The Numeric class provides methods for working with numbers.

Values for this data type are limited to 15 significant digits.

Syntax

Numeric

Methods

Table 1. Object Methods
Name Description
abs()
Returns the absolute value.
atan2(Numeric x)
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta)
byteValue()
Returns the value converted to a byte.
cbrt()
Returns the cube root of a numeric value.
ceil()
Returns the smallest numeric value that is greater than or equal to the value and is equal to a mathematical integer.
cos()
Returns the trigonometric cosine of an angle.
cosh()
Returns the hyperbolic cosine of a numeric value.
exp()
Returns the base -e exponential.
floor()
Returns the largest numeric value that is less than or equal to the value and is equal to a mathematical integer.
format("format-string")

Converts the value to a string representation defined by a format string.

getExponent()
Returns the unbiased exponent used in the representation of a numeric value.
intValue()
Returns the value converted to an integer (signed 32 bit).
isInfinite()
Returns TRUE if the value has infinite value.
isNaN()
Returns TRUE if the value is not a number.
isNull()

Returns TRUE if the object is tagged as null, otherwise false. This is the case for null valued input variables read from the input stream.

For backward compatibility, null values do not have special behavior when used with the various operators. Specifically a numeric input variable that is null behaves in arithmetic like the 0 value.

log()
Returns the natural logarithm (base e) of a numeric value.
log10()
Returns the base 10 logarithm of a numeric value.
max(Numeric b)
Returns the greater of two values.
min(Numeric b)
Returns the smaller of two values.
rint()
Returns the Numeric value that is closest in value to the value and is equal to a mathematical integer.
round()
Returns the closes integer to the value.
signum()
Returns the signum function of the value; zero if the value is zero, 1.0 if the value is greater than zero, -1.0 if the value is less than zero.
sin()
Returns the trigonometric sine, measured in radians.
sinh()
Returns the hyperbolic sine of a numeric value.
sqrt()
Returns the correctly rounded positive square root of a double value.
tan()
Returns the tangent of an angle measured in radians.
tanh()
Returns the hyperbolic tangent of a numeric value.
toBoolean()

Returns the Boolean false when the value is 0. Returns true for any other value.

toChar()

Returns the unicode character representation of a numeric value.

For example, 65.toChar() yields "A".

toColor()

Returns a color object. The value is interpreted as a RGB integer.

toDegrees()

Converts the value from radians to degrees.

toRadians()

Converts the value from degrees to radians.

toString()
Converts the value to a string representation.
getPhysicalPageNumber()
Gets the current page number of the physical page.
getTotalNumberOfPhysicalPages()
Gets the total number of physical pages.
getPageNumber(String pageName)
Gets the page number of the specified page.
getTotalNumberOfPages(String pageName)
Gets the total number of pages for the specified page.

Usage

Important: This data type is limited to 15 significant digits.

With RTL classes, it is not possible to create and subclass objects. The new keyword is not supported.