Math.absDouble()

Signature

double absDouble (double a)

Domain

action, condition

Description

Returns the absolute value of a double value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.
Special cases:
If the argument is positive zero or negative zero, the result is positive zero.
If the argument is infinite, the result is positive infinity.
If the argument is NaN, the result is NaN.
In other words, the result is the same as the value of the expression: Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)

Parameters

NameTypeDescription
adoubleThe argument whose absolute value is to be determined.

Returns

TypeDescription
doubleThe absolute value of the argument.

Cautions

none

Example


String result = String.valueOfDouble (Math.absDouble (-34.78));

Result is: result contains: "34.78"