Float16
classin packageklyn
public class Float16 extends AbstractFloat implements ValueType
└ Float16
All Implemented Interfaces: ValueType

Represents a 16-bit IEEE 754 floating-point number.

Decimal literals with the h suffix and the special words nanh and infh have type Float16. nanh represents a quiet not-a-number value, while infh represents positive infinity; use -infh for negative infinity. The corresponding nan and inf words have type Double.

A NaN value is unordered: it is unequal to every value, including itself, and all <, <=, > and >= comparisons involving it return false.

Example
value = 3.5h
notANumber = nanh
positiveInfinity = infh
negativeInfinity = -infh

assert type(value) == Float16
assert type(notANumber) == Float16
assert notANumber != notANumber
assert notANumber is nanh
assert positiveInfinity is infh
assert negativeInfinity is -infh
assert positiveInfinity > value
assert negativeInfinity < value
Inherited Properties
propertyInherited Properties from Object: type
Constructors
Modifier and Type Member Description
public native Float16 Builds the neutral Float16 value (0.0h).
public native Float16
Float16(value as Boolean)
Builds a Float16 from a Boolean value (false = 0.0h, true = 1.0h).
public native Float16
Float16(value as Char)
Builds a Float16 from a Unicode scalar value.
public native Float16
Float16(value as CodeUnit)
Builds a Float16 from a UTF-16 code-unit value.
public native Float16
Float16(value as Double)
Builds a Float16 from a Double value.
public native Float16
Float16(value as Float16)
Builds a Float16 from a Float16 value.
public native Float16
Float16(value as Int)
Builds a Float16 from an Int value.
public native Float16
Float16(value as Long)
Builds a Float16 from a signed 64-bit integer.
public native Float16
Float16(value as String) throws ValueException
Builds a Float16 from a textual representation.
public native Float16
Float16(value as UInt)
Builds a Float16 from an unsigned 32-bit integer.
public native Float16
Float16(value as ULong)
Builds a Float16 from an unsigned 64-bit integer.
Methods
Modifier and Type Member Description
public native override toString
toString() as String
Converts this value to its textual representation.
public static tryParse
tryParse( readonly value as String, out result as Float16 ) as Boolean
Parses a Float16 value from text.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml
Operators
Modifier and Type Member Description
public native static operator<( readonly a as Float16, readonly b as Float16 ) as Boolean Tests whether a is strictly lower than b.
public native static operator<=( readonly a as Float16, readonly b as Float16 ) as Boolean Tests whether a is lower than or equal to b.
public native static operator!=( readonly a as Float16, readonly b as Float16 ) as Boolean Tests whether two Float16 values are different.
public native static operator%( readonly a as Float16, readonly b as Float16 ) as Float16 Computes the floor remainder, with the divisor's sign (including signed zero).
public native static operator%=( readonly a as Float16, readonly b as Float16 ) as Void Replaces a with its floor remainder, with the divisor's sign.
public native static operator*( readonly a as Float16, readonly b as Float16 ) as Float16 Multiplies two Float16 values.
public native static operator**( readonly value as Float16, readonly power as Float16 ) as Float16 Raises a Float16 value to a power.
public native static operator**=( readonly value as Float16, readonly power as Float16 ) as Void Replaces value with value ** power.
public native static operator*=( readonly a as Float16, readonly b as Float16 ) as Void Multiplies a by b in place.
public native static operator+( readonly a as Float16, readonly b as Float16 ) as Float16 Adds two Float16 values.
public native static operator+=( readonly a as Float16, readonly b as Float16 ) as Void Adds b to a in place.
public native static operator-( readonly a as Float16, readonly b as Float16 ) as Float16 Subtracts one Float16 value from another.
public native static operator-=( readonly a as Float16, readonly b as Float16 ) as Void Subtracts b from a in place.
public native static operator/( readonly a as Float16, readonly b as Float16 ) as Float16 Divides one Float16 value by another.
public native static operator/=( readonly a as Float16, readonly b as Float16 ) as Void Divides a by b in place.
public native static operator==( readonly a as Float16, readonly b as Float16 ) as Boolean Tests whether two Float16 values are equal.
public native static operator>( readonly a as Float16, readonly b as Float16 ) as Boolean Tests whether a is strictly greater than b.
public native static operator>=( readonly a as Float16, readonly b as Float16 ) as Boolean Tests whether a is greater than or equal to b.