Float
64-bit Floating-point numbers
pi
let pi : Float
Ratio of the circumference of a circle to its diameter.
e
let e : Float
Base of the natural logarithm.
format
func format(fmt : {#fix : Nat8; #exp : Nat8; #gen : Nat8; #hex : Nat8; #exact}, x : Float) : Text
Formatting. format(fmt, x)
formats x
to Text
according to the
formatting directive fmt
, which can take one of the following forms:
-
#fix prec
as fixed-point format withprec
digits -
#exp prec
as exponential format withprec
digits -
#gen prec
as generic format withprec
digits -
#hex prec
as hexadecimal format withprec
digits -
#exact
as exact format that can be decoded without loss.
toText
let toText : Float -> Text
Conversion to Text. Use format(fmt, x)
for more detailed control.
toInt64
let toInt64 : Float -> Int64
Conversion to Int64 by truncating Float, equivalent to toInt64(trunc(f))
fromInt64
let fromInt64 : Int64 -> Float
Conversion from Int64.
toInt
let toInt : Float -> Int
Conversion to Int.
fromInt
let fromInt : Int -> Float
Conversion from Int. May result in Inf
.