Package com.apple.foundationdb.half
Class HalfMath
java.lang.Object
com.apple.foundationdb.half.HalfMath
The class
HalfMath contains methods for performing basic numeric operations on or using Half objects.-
Method Summary
-
Method Details
-
ulp
Returns the size of an ulp of the argument. An ulp, unit in the last place, of ahalfvalue is the positive distance between this floating-point value and thehalfvalue next larger in magnitude.
Note that for non-NaN x,ulp(-x) == ulp(x).Special Cases:
- If the argument is NaN, then the result is NaN.
- If the argument is positive or negative infinity, then the result is positive infinity.
- If the argument is positive or negative zero, then the result is
Float.MIN_VALUE. - If the argument is ±
Half.MAX_VALUE, then the result is equal to 25.
- Parameters:
half- the floating-point value whose ulp is to be returned- Returns:
- the size of an ulp of the argument
-
getExponent
Returns the unbiased exponent used in the representation of ahalf.Special cases:
- If the argument is NaN or infinite, then the result is
Half.MAX_EXPONENT+ 1. - If the argument is zero or subnormal, then the result is
Half.MIN_EXPONENT- 1.
- Parameters:
half- ahalfvalue- Returns:
- the unbiased exponent of the argument
- If the argument is NaN or infinite, then the result is
-
abs
Returns the absoluteHalfobject of ahalfinstance.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 a "canonical" NaN (preserving Not-a-Number (NaN) signaling).
- Parameters:
half- the argument whose absolute value is to be determined- Returns:
- the absolute value of the argument.
-