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

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

Decimal literals with the f suffix and the special words nanf and inff have type Float. nanf represents a quiet not-a-number value, while inff represents positive infinity; use -inff 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.5f
notANumber = nanf
positiveInfinity = inff
negativeInfinity = -inff

assert type(value) == Float
assert type(notANumber) == Float
assert notANumber != notANumber
assert notANumber is nanf
assert positiveInfinity is inff
assert negativeInfinity is -inff
assert positiveInfinity > value
assert negativeInfinity < value
Inherited Properties
propertyInherited Properties from Object: type
Constructors
Modifier and Type Member Description
public native Float Builds the neutral Float value (0.0f).
public native Float
Float(value as Boolean)
Builds a Float from a Boolean value (false = 0.0f, true = 1.0f).
public native Float
Float(value as Char)
Builds a Float from a Unicode scalar value.
public native Float
Float(value as CodeUnit)
Builds a Float from a UTF-16 code-unit value.
public native Float
Float(value as Double)
Builds a Float from a Double value.
public native Float
Float(value as Float)
Builds a Float from a Float value.
public native Float
Float(value as Int)
Builds a Float from an Int value.
public native Float
Float(value as Long)
Builds a Float from a signed 64-bit integer.
public native Float
Float(value as String) throws ValueException
Builds a Float from a textual representation.
public native Float
Float(value as UInt)
Builds a Float from an unsigned 32-bit integer.
public native Float
Float(value as ULong)
Builds a Float 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 Float ) as Boolean:
Parses a Float value from text.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toString, toXml
Operators
Modifier and Type Member Description
public native static operator!=( readonly a as Float, readonly b as Float ) as Boolean Tests whether two Float values are different.
public native static operator%( readonly a as Float, readonly b as Float ) as Float Computes the remainder of one Float value divided by another.
public native static operator%=( readonly a as Float, readonly b as Float ) as Void Replaces a with the remainder of a divided by b.
public native static operator*( readonly a as Float, readonly b as Float ) as Float Multiplies two Float values.
public native static operator**( readonly value as Float, readonly power as Float ) as Float Raises a Float value to a power.
public native static operator**=( readonly value as Float, readonly power as Float ) as Void Replaces value with value ** power.
public native static operator*=( readonly a as Float, readonly b as Float ) as Void Multiplies a by b in place.
public native static operator+( readonly a as Float, readonly b as Float ) as Float Adds two Float values.
public native static operator+=( readonly a as Float, readonly b as Float ) as Void Adds b to a in place.
public native static operator-( readonly a as Float, readonly b as Float ) as Float Subtracts one Float value from another.
public native static operator-=( readonly a as Float, readonly b as Float ) as Void Subtracts b from a in place.
public native static operator/( readonly a as Float, readonly b as Float ) as Float Divides one Float value by another.
public native static operator/=( readonly a as Float, readonly b as Float ) as Void Divides a by b in place.
public native static operator<( readonly a as Float, readonly b as Float ) as Boolean Tests whether a is strictly lower than b.
public native static operator<=( readonly a as Float, readonly b as Float ) as Boolean Tests whether a is lower than or equal to b.
public native static operator==( readonly a as Float, readonly b as Float ) as Boolean Tests whether two Float values are equal.
public native static operator>( readonly a as Float, readonly b as Float ) as Boolean Tests whether a is strictly greater than b.
public native static operator>=( readonly a as Float, readonly b as Float ) as Boolean Tests whether a is greater than or equal to b.