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 precas fixed-point format withprecdigits -
#exp precas exponential format withprecdigits -
#gen precas generic format withprecdigits -
#hex precas hexadecimal format withprecdigits -
#exactas 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 via Int64, equivalent to Int64.toInt(toInt64(trunc(f)))
fromInt
let fromInt : Int -> Float
Conversion from Int via Int64. May trap.