f64
64-bit floating-point numbers, f64: binary64’s own constants, its safe integers, conversion from the other shapes, and conversion from text, the same in every locale. The functions that every float format shares, such as float::sqrt and float::format, are in float, and abs, sign, and range are the prelude’s.
Write these names after f64::, as in f64::min_safe_int.
min_safe_int
def min_safe_int! f64Smallest integer whose neighboring integers remain exactly representable.
max_safe_int
def max_safe_int! f64Largest integer whose neighboring integers remain exactly representable.
epsilon
def epsilonThe gap between one and the next larger number; not a universal comparison tolerance.
finite
set finite = f64:{-1.7976931348623157e308..1.7976931348623157e308}Every number but the infinities and nan.
pi
def piThe binary64 approximation of the ratio of a circle’s circumference to its diameter.
e
def eThe binary64 approximation of the base of natural logarithms.
from
def from[set T: numeric](value! T)! f64The f64 nearest a number of any shape, rounding once, ties to even: an int from its exact Value, so an int
beyond 2^53 may round, and an f32 exactly. An f64 stays as it is.
is_safe_int
def is_safe_int(value! f64)! boolTrue for finite integers in the inclusive min_safe_int–max_safe_int range.
parse
def parse(text! str)? f64Parses a complete signed decimal/scientific spelling, or exactly nan, inf, or -inf, into one f64, and gives
an empty Bag for any other text: f64::parse(".5") is 0.5, f64::parse("nan") is nan, and f64::parse("x") is
empty. Accepts +1, .5, 1., and exponents; at least one mantissa digit is required. Whitespace, separators,
radix prefixes, and trailing text are not numbers. Conversion rounds once to binary64, allows overflow to infinity,
and canonicalizes negative zero. It takes one text, so a Bag of texts is parsed with map.