Skip to content

Float

64-bit floating point numbers.

Rounding preserves signed zero and rounds halfway cases away from zero. signum returns NaN for NaN and distinguishes positive and negative zero.

Inherits from: Num

Constructor

Float()

Float accepts a float or an integer that can be represented exactly.

assert_eq (Float 42) 42.0

The lowercase float function performs numeric coercion and parsing:

assert_eq (float "3.14") 3.14
assert_eq (float true) 1.0

Class Fields

EPSILON

Difference between 1.0 and the next greater representable value.

INF

Positive infinity.

NAN

A not-a-number value.

Methods

is_finite() -> Bool

Tests whether the value is finite.

is_infinite() -> Bool

Tests whether the value is positive or negative infinity.

is_nan() -> Bool

Tests whether the value is NaN.

is_normal() -> Bool

Tests whether the value is normal.

is_subnormal() -> Bool

Tests whether the value is subnormal.