# Float64

## Definitions

`def abs(x: Float64): Float64`

SourceReturns the absolute value of `x`

.

`def ceil(x: Float64): Float64`

SourceReturns `x`

rounded up to a Float64 representing the nearest larger integer value.

`def clampToFloat32(x: Float64, minimum: Float32, maximum: Float32): Float32`

SourceConvert `x`

to a `Float32`

.

Returns `x`

clamped within the Float32 range `minimum`

to `maximum`

.

`def clampToInt16(x: Float64, minimum: Int16, maximum: Int16, nanValue: Int16): Int16`

SourceConvert `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: Float64, minimum: Int32, maximum: Int32, nanValue: Int32): Int32`

SourceConvert `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: Float64, minimum: Int64, maximum: Int64, nanValue: Int64): Int64`

SourceConvert `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: Float64, minimum: Int8, maximum: Int8, nanValue: Int8): Int8`

SourceConvert `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 doubleValue(i: java.lang.Double): Float64`

SourceGet the primitive Float64 value from its object representation (i.e. ##java.lang.Double).

This function is expected to be used when marshaling Float64s from Java. Generally in Flix
code you should not need to use `##java.lang.Double`

.

`def exp(x: Float64): Float64`

SourceReturns the exponential of `x`

.

`def floor(x: Float64): Float64`

SourceReturns `x`

rounded down to a Float64 representing the nearest smaller integer value.

`def fromString(s: String): Option[Float64]`

SourceParse the string `s`

as a Float64, leading or trailing whitespace is trimmed.
A successful parse is wrapped with `Some(x)`

, a parse failure is indicated by `None`

.

`def isFinite(x: Float64): Bool`

SourceReturns true if and only if `x`

is a non-infinite and non-Nan `Float64`

value.

`def isInfinite(x: Float64): Bool`

SourceReturns true if and only if `x`

is an infinite and non-Nan `Float64`

value.

`def isNan(x: Float64): Bool`

SourceReturns true if and only if `x`

is the NaN value of type `Float64`

.

`def max(x: Float64, y: Float64): Float64`

SourceReturns the larger of `x`

and `y`

.

`def maxExponent(): Int32`

SourceReturns the maximum exponent that a `Float64`

may have.

`def maxValue(): Float64`

SourceReturns the maximum number representable by a `Float64`

.

`def min(x: Float64, y: Float64): Float64`

SourceReturns the smaller of `x`

and `y`

.

`def minExponent(): Int32`

SourceReturns the minimum exponent that a `Float64`

may have.

`def minPositiveValue(): Float64`

SourceReturns the minimum positive number representable by a `Float64`

.

`def minValue(): Float64`

SourceReturns the minimum number representable by a `Float64`

.

`def nan(): Float64`

SourceReturns the NaN (not a number) value of type `Float64`

.

`def negativeInfinity(): Float64`

SourceReturns the negative infinity value of type `Float64`

.

`def positiveInfinity(): Float64`

SourceReturns the positive infinity value of type `Float64`

.

`def pow(x: Float64, n: Float64): Float64`

SourceReturns `x`

raised to the power of `n`

.

`def round(x: Float64): Float64`

SourceReturns `x`

rounded to a Float64 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.5f64) == 0.0f64`

).

`def size(): Int32`

SourceReturns the number of bits used to represent a `Float64`

.

`def toString(x: Float64): String`

SourceReturn a string representation of `x`

.

`def tryToBigDecimal(x: Float64): Option[BigDecimal]`

SourceConvert `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: Float64): Option[BigInt]`

SourceConvert `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 tryToFloat32(x: Float64): Option[Float32]`

SourceConvert `x`

to an `Option[Float32]`

.

Returns `Some(x as Float32)`

if the numeric value of `x`

is within the range
of Float32, loss of precision may occur.

Returns `None`

if the numeric value of `x`

is outside the range of Float32
(i.e. 1.4E-45 to 3.4028235E38).

If `x`

is NaN return `Some(Float32.NaN)``

, if `x`

is positive or negative infinity return
`Some`

wrapping the corresponding Float32 infinity.

`def tryToInt16(x: Float64): Option[Int16]`

SourceConvert `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: Float64): Option[Int32]`

SourceConvert `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.

`def tryToInt64(x: Float64): Option[Int64]`

SourceConvert `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 Float64 values is imprecise.

`def tryToInt8(x: Float64): Option[Int8]`

SourceConvert `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(i: Float64): java.lang.Double`

SourceConvert an Float64 value to its object representation (i.e. ##java.lang.Double).

This function is expected to be used when marshaling Float64s to Java. Generally in Flix
code you should not need to use `##java.lang.Double`

.