-
public final class HalfKt
-
-
Method Summary
Modifier and Type Method Description final HalfgetH()final HalfgetH()final static HalfHalf(Double value)Converts the specified double-precision float value into a half-precision float value. final static HalfHalf(Float value)Converts the specified single-precision float value into a half-precision float value. final static HalfHalf(String value)Returns the half-precision float value represented by the specified string. final static HalftoHalf(Double $self)Converts this double-precision float value into a half-precision float value. final static HalftoHalf(Float $self)Converts this single-precision float value into a half-precision float value. final static HalftoHalf(String $self)Returns the half-precision float value represented by the specified string. final static Halfsqrt(Half x)final static Halfabs(Half x)Returns the absolute value of the specified half-precision float. final static Halfmin(Half x, Half y)Returns the smaller of two half-precision float values (the value closest to negative infinity). final static Halfmax(Half x, Half y)Returns the larger of two half-precision float values (the value closest to positive infinity). final static Halfround(Half x)Returns the closest integral half-precision float value to the specified half-precision float value. final static Halffloor(Half x)Returns the largest half-precision float value toward positive infinity less than or equal to the specified half-precision float value. final static Halfceil(Half x)Returns the smallest half-precision float value toward negative infinity greater than or equal to the specified half-precision float value. final static Halftruncate(Half x)Returns the truncated half-precision float value of the specified half-precision float value. -
-
Method Detail
-
Half
final static Half Half(Double value)
Converts the specified double-precision float value into a half-precision float value. The following special cases are handled:
If the input is NaN (see Double.isNaN), the returned value is Half.NaN
If the input is Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY, the returned value is respectively Half.POSITIVE_INFINITY or Half.NEGATIVE_INFINITY
If the input is 0 (positive or negative), the returned value is Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_VALUE, the returned value is flushed to Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_NORMAL, the returned value is a denormal half-precision float
Otherwise, the returned value is rounded to the nearest representable half-precision float value
- Parameters:
value- The double-precision float value to convert to half-precision
-
Half
final static Half Half(Float value)
Converts the specified single-precision float value into a half-precision float value. The following special cases are handled:
If the input is NaN (see Float.isNaN), the returned value is Half.NaN
If the input is Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY, the returned value is respectively Half.POSITIVE_INFINITY or Half.NEGATIVE_INFINITY
If the input is 0 (positive or negative), the returned value is Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_VALUE, the returned value is flushed to Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_NORMAL, the returned value is a denormal half-precision float
Otherwise, the returned value is rounded to the nearest representable half-precision float value
- Parameters:
value- The single-precision float value to convert to half-precision
-
Half
final static Half Half(String value)
Returns the half-precision float value represented by the specified string. The string is converted to a half-precision float value as if by the String.toFloat() method.</p>
Calling this function is equivalent to calling:
Half(value.toFloat())- Parameters:
value- A string to be converted to a {@code Half}
-
toHalf
final static Half toHalf(Double $self)
Converts this double-precision float value into a half-precision float value. The following special cases are handled:
If the input is NaN (see Double.isNaN), the returned value is Half.NaN
If the input is Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY, the returned value is respectively Half.POSITIVE_INFINITY or Half.NEGATIVE_INFINITY
If the input is 0 (positive or negative), the returned value is Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_VALUE, the returned value is flushed to Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_NORMAL, the returned value is a denormal half-precision float
Otherwise, the returned value is rounded to the nearest representable half-precision float value
-
toHalf
final static Half toHalf(Float $self)
Converts this single-precision float value into a half-precision float value. The following special cases are handled:
If the input is NaN (see Float.isNaN), the returned value is Half.NaN
If the input is Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY, the returned value is respectively Half.POSITIVE_INFINITY or Half.NEGATIVE_INFINITY
If the input is 0 (positive or negative), the returned value is Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_VALUE, the returned value is flushed to Half.POSITIVE_ZERO or Half.NEGATIVE_ZERO
If the input is less than Half.MIN_NORMAL, the returned value is a denormal half-precision float
Otherwise, the returned value is rounded to the nearest representable half-precision float value
-
toHalf
final static Half toHalf(String $self)
Returns the half-precision float value represented by the specified string. The string is converted to a half-precision float value as if by the String.toFloat() method.</p>
Calling this function is equivalent to calling:
Half(value.toFloat())
-
abs
final static Half abs(Half x)
Returns the absolute value of the specified half-precision float. Special values are handled in the following ways:
If the specified half-precision float is NaN, the result is NaN
If the specified half-precision float is zero (negative or positive), the result is positive zero (see POSITIVE_ZERO)
If the specified half-precision float is infinity (negative or positive), the result is positive infinity (see POSITIVE_INFINITY)
-
min
final static Half min(Half x, Half y)
Returns the smaller of two half-precision float values (the value closest to negative infinity). Special values are handled in the following ways:
If either value is NaN, the result is NaN
Half.NEGATIVE_ZERO is smaller than Half.POSITIVE_ZERO
- Parameters:
x- The first half-precision valuey- The second half-precision value
-
max
final static Half max(Half x, Half y)
Returns the larger of two half-precision float values (the value closest to positive infinity). Special values are handled in the following ways:
If either value is NaN, the result is NaN
Half.POSITIVE_ZERO is greater than Half.NEGATIVE_ZERO
- Parameters:
x- The first half-precision valuey- The second half-precision value
-
round
final static Half round(Half x)
Returns the closest integral half-precision float value to the specified half-precision float value. Special values are handled in the following ways:
If the specified half-precision float is NaN, the result is NaN
If the specified half-precision float is infinity (negative or positive), the result is infinity (with the same sign)
If the specified half-precision float is zero (negative or positive), the result is zero (with the same sign)
- Parameters:
x- A half-precision float value
-
floor
final static Half floor(Half x)
Returns the largest half-precision float value toward positive infinity less than or equal to the specified half-precision float value. Special values are handled in the following ways:
If the specified half-precision float is NaN, the result is NaN
If the specified half-precision float is infinity (negative or positive), the result is infinity (with the same sign)
If the specified half-precision float is zero (negative or positive), the result is zero (with the same sign)
- Parameters:
x- A half-precision float value
-
ceil
final static Half ceil(Half x)
Returns the smallest half-precision float value toward negative infinity greater than or equal to the specified half-precision float value. Special values are handled in the following ways:
If the specified half-precision float is NaN, the result is NaN
If the specified half-precision float is infinity (negative or positive), the result is infinity (with the same sign)
If the specified half-precision float is zero (negative or positive), the result is zero (with the same sign)
- Parameters:
x- A half-precision float value
-
truncate
final static Half truncate(Half x)
Returns the truncated half-precision float value of the specified half-precision float value. Special values are handled in the following ways:
If the specified half-precision float is NaN, the result is NaN
If the specified half-precision float is infinity (negative or positive), the result is infinity (with the same sign)
If the specified half-precision float is zero (negative or positive), the result is zero (with the same sign)
- Parameters:
x- A half-precision float value
-
-
-
-