Float32

Definitions

def abs(x: Float32): Float32 Source

Returns the absolute value of x.

def ceil(x: Float32): Float32 Source

Returns x rounded up to a Float32 representing the nearest larger integer value.

def clampToInt16(x: Float32, minimum: Int16, maximum: Int16, nanValue: Int16): Int16 Source

Convert x to an Int16.

Returns x clamped within the Int16 range minimum to maximum.

Warning: it is recommended to test x for NaN (not-a-number) before calling this function. Relying on nanValue to convert NaN to a permissable Int16 risks masking it.

def clampToInt32(x: Float32, minimum: Int32, maximum: Int32, nanValue: Int32): Int32 Source

Convert x to an Int32.

Returns x clamped within the Int32 range minimum to maximum.

Warning: it is recommended to test x for NaN (not-a-number) before calling this function. Relying on nanValue to convert NaN to a permissable Int32 risks masking it.

def clampToInt64(x: Float32, minimum: Int64, maximum: Int64, nanValue: Int64): Int64 Source

Convert x to an Int64.

Returns x clamped within the Int64 range minimum to maximum.

Warning: it is recommended to test x for NaN (not-a-number) before calling this function. Relying on nanValue to convert NaN to a permissable Int64 risks masking it.

def clampToInt8(x: Float32, minimum: Int8, maximum: Int8, nanValue: Int8): Int8 Source

Convert x to an Int8.

Returns x clamped within the Int8 range minimum to maximum.

Warning: it is recommended to test x for NaN (not-a-number) before calling this function. Relying on nanValue to convert NaN to a permissable Int8 risks masking it.

def floatValue(d: java.lang.Float): Float32 Source

Get the primitive Float32 value from its object representation (i.e. java.lang.Float).

This function is expected to be used when marshaling Float32s from Java. Generally in Flix code you should not need to use java.lang.Float.

def floor(x: Float32): Float32 Source

Returns x rounded down to a Float32 representing the nearest smaller integer value.

def fromString(s: String): Option[Float32] Source

Parse the string s as a Float32, leading or trailing whitespace is trimmed. A successful parse is wrapped with Some(x), a parse failure is indicated by None.

def isFinite(x: Float32): Bool Source

Returns true if and only if x is a non-infinite and non-Nan Float32 value.

def isInfinite(x: Float32): Bool Source

Returns true if and only if x is an infinite and non-Nan Float32 value.

def isNan(x: Float32): Bool Source

Returns true if and only if x is the NaN value of type Float32.

def max(x: Float32, y: Float32): Float32 Source

Returns the larger of x and y.

def maxExponent(): Int32 Source

Returns the maximum exponent that a Float32 may have.

def maxValue(): Float32 Source

Returns the maximum number representable by a Float32.

def min(x: Float32, y: Float32): Float32 Source

Returns the smaller of x and y.

def minExponent(): Int32 Source

Returns the minimum exponent that a Float32 may have.

def minPositiveValue(): Float32 Source

Returns the minimum positive number representable by a Float32.

def minValue(): Float32 Source

Returns the minimum number representable by a Float32.

def nan(): Float32 Source

Returns the NaN (not a number) value of type Float32.

def negativeInfinity(): Float32 Source

Returns the negative infinity value of type Float32.

def positiveInfinity(): Float32 Source

Returns the positive infinity value of type Float32.

def pow(b: Float32, n: Float32): Float32 Source

Returns b raised to the power of n.

def round(x: Float32): Float32 Source

Returns x rounded to a Float32 representing the nearest integer value.

The rounding may be upwards or downwards. If the rounding up and rounding down are equally close, x will be rounded to an even value (i.e. round(0.5f32) == 0.0f32).

def size(): Int32 Source

Returns the number of bits used to represent a Float32.

def toFloat64(x: Float32): Float64 Source

Convert x to an Float64.

def toString(x: Float32): String Source

Return a string representation of x.

def tryToBigDecimal(x: Float32): Option[BigDecimal] Source

Convert x to an Option[BigDecimal].

Returns Some(x as BigDecimal) if the numeric value of x is representable as a BigDecimal value.

If x is NaN or infinity return None.

def tryToBigInt(x: Float32): Option[BigInt] Source

Convert x to an Option[BigInt].

Returns Some(x as BigInt) if the numeric value of x is representable as a BigInt.

Returns None if the value of x is NaN or infinity.

def tryToInt16(x: Float32): Option[Int16] Source

Convert x to an Option[Int16].

Returns Some(x as Int16) if the numeric value of x is within the range of Int16, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int16 (i.e. -32768 to 32767), or it is NaN or infinity.

def tryToInt32(x: Float32): Option[Int32] Source

Convert x to an Option[Int32].

Returns Some(x as Int32) if the numeric value of x is within the range of Int32, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int32 (i.e. -2147483648 to 2147483647), or it is NaN or infinity.

Note: while the range of an Int32 is precisely defined using Int32 values, converting this range to Float32 values is imprecise.

def tryToInt64(x: Float32): Option[Int64] Source

Convert x to an Option[Int64].

Returns Some(x as Int64) if the numeric value of x is within the range of Int64, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int64 (i.e. -9223372036854775808 to 9223372036854775807), or it is NaN or infinity.

Note: while the range of an Int64 is precisely defined using Int64 values, converting this range to Float32 values is imprecise.

def tryToInt8(x: Float32): Option[Int8] Source

Convert x to an Option[Int8].

Returns Some(x as Int8) if the numeric value of x is within the range of Int8, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int8 (i.e. -128 to 127), or it is NaN or infinity.

def valueOf(d: Float32): java.lang.Float Source

Convert an Float32 value to its object representation (i.e. java.lang.Float).

This function is expected to be used when marshaling Float32s to Java. Generally in Flix code you should not need to use java.lang.Float.