RTL Class Reference / The Numeric Class |
Like all RTL Classes, the "new" keyword is not supported, so that it is not possible to create and subclass objects.
abs()
Returns the absolute value of an int value:
cos()
Returns the trigonometric cosine of an angle. However, If the value is NaN or an infinity, then the result is NaN.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
sin()
Returns the trigonometric sine of an angle. However,
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
tan()
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
byteValue()
Returns the value converted to a byte .
cbrt()
Returns the cube root of a double value. For positive finite x, cbrt(-x) == -cbrt(x); that is, the cube root of a negative value is the negative of the cube root of that value's magnitude.
Special cases:
The computed result must be within 1 ulp of the exact result.
ceil()
Returns the smallest (closest to negative infinity) double value that is greater than or equal to the value and is equal to a mathematical integer.
Special cases:
Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x).
cosh()
Returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is defined to be (ex + e-x)/2 where e is Euler's number.
Special cases:
The computed result must be within 2.5 ulps of the exact result.
exp()
Returns Euler's number e raised to the power of a double value. Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
floor()
Returns the largest (closest to positive infinity) double value that is less than or equal to the value and is equal to a mathematical integer.
Special cases:
getExponent()
Returns the unbiased exponent used in the representation of a float.
intValue()
returns the value converted to an integer (signed 32 bit)
isInfinite()
returns the Boolean value true in case the value has the infinite value
isNaN()
returns the Boolean value true in case that the value is not a number
log()
Returns the natural logarithm (base e) of a double value.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
log10()
Returns the base 10 logarithm of a double value.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
rint()
Returns the double (floating-point) value that is closest in value to the value and is equal to a mathematical integer. If two double values that are mathematical integers are equally close, the result is the integer value that is even.
Returns:
the closest floating-point value to a that is equal to a mathematical integer.
round()
Returns the closest int to the value. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type int. In other words, the result is equal to the value of the expression:
(int)Math.floor(a + 0.5f)
See Also:
Integer.MAX_VALUE, Integer.MIN_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.
Returns:
the signum function of the value
sinh()
Returns the hyperbolic sine of a double value. The hyperbolic sine of x is defined to be (ex - e-x)/2 where e is Euler's number.
The computed result must be within 2.5 ulps of the exact result.
sqrt()
Returns the correctly rounded positive square root of a double value.
Otherwise, the result is the double value closest to the true mathematical square root of the value
tanh()
Returns the hyperbolic tangent of a double value. The hyperbolic tangent of x is defined to be (ex - e-x)/(ex + e-x), in other words, sinh(x)/cosh(x). Note that the absolute value of the exact tanh is always less than 1.
The computed result must be within 2.5 ulps of the exact result. The result of tanh for any finite input must have an absolute value less than or equal to 1. Note that once the exact result of tanh is within 1/2 of an ulp of the limit value of ±1, correctly signed ±1.0 should be returned.
toBoolean()
Returns the Boolean false in case that value is 0. Returns true for any other value.
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
toChar()
Converts the value to a unicode character representation (e.g. 65.toChar yields "A").
atan2(Numeric x))
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi.
The computed result must be within 2 ulps of the exact result. Results must be semi-monotonic.
Parameters:
x - the abscissa coordinate
max(Numeric b)
Returns the greater of two int values. That is, the result is the argument closer to the value of Integer.MAX_VALUE. If the argument has the same value as the object's value the result is that same value.
Parameters:
b - an argument.
See Also: Long.MAX_VALUE
min(Numeric b))
Returns the smaller of two int values. That is, the result is the argument closer to the value of Integer.MIN_VALUE. If the argument has the same value as the objects value the result is that same value.
Parameters:
b - an argument.
See Also: Long.MIN_VALUE
format("format-string")
Converts the value to a string representation defined by a format string. The format string syntax is compatible to the D4GL "USING" format string. The formatting takes the values of the environment variables DBFORMAT and DBMONEY into account.
Character | Description |
---|---|
* | Fills with asterisks any position that would otherwise be blank. |
& | Fills with zeros any position that would otherwise be blank. |
# | This does not change any blank positions in the display. |
< | Causes left alignment. |
, (comma) | Defines the position of the thousands separator. The thousands separator is not displayed if there are no digits to the left. By default, the thousands separator is a comma, but it can be another character as defined by DBFORMAT. |
. (period) | Defines the position of the decimal separator. Only a single decimal separator may be specified. By default, the decimal separator is a period, however it can be another character as defined by DBMONEY or DBFORMAT. |
- | Displays a minus sign for negative numbers. |
$ | This is the placeholder for the front specification of DBMONEY or DBFORMAT. |
( | Displayed as left parentheses for negative numbers (accounting parentheses). |
) | Displayed as right parentheses for negative numbers (accounting parentheses). |