struct Float64
inherits Float
¶
Constants¶
DIGITS = 15
¶
15
The number of decimal digits that can be represented without losing precision
EPSILON = 2.2204460492503131e-16
¶
2.2204460492503131e-16
The machine epsilon (difference between 1.0 and the next representable value)
INFINITY = (1_f64 / 0_f64).as(Float64)
¶
(1_f64 / 0_f64).as(Float64)
MANT_DIGITS = 53
¶
53
The number of digits that can be represented without losing precision (in base RADIX)
MAX = 1.7976931348623157e+308
¶
1.7976931348623157e+308
Largest finite value
MAX_10_EXP = 308
¶
308
The maximum possible power of 10 exponent (such that 10**MAX_10_EXP is representable)
MAX_EXP = 1024
¶
1024
The maximum possible normal power of 2 exponent
MIN = -1.7976931348623157e+308
¶
-1.7976931348623157e+308
Smallest finite value
MIN_10_EXP = -307
¶
-307
The minimum possible power of 10 exponent (such that 10**MIN_10_EXP is representable)
MIN_EXP = -1021
¶
-1021
The minimum possible normal power of 2 exponent
MIN_POSITIVE = 2.2250738585072014e-308
¶
2.2250738585072014e-308
Smallest representable positive value
NAN = (0_f64 / 0_f64).as(Float64)
¶
(0_f64 / 0_f64).as(Float64)
RADIX = 2
¶
2
The radix or integer base used by the internal representation
Class methods¶
Methods¶
#round_away
¶
Rounds towards the nearest integer. If both neighboring integers are equidistant, rounds away from zero.
#round_even : self
¶
: self
Rounds towards the nearest integer. If both neighboring integers are equidistant, rounds towards the even neighbor (Banker's rounding).
#to_f : Float64
¶
: Float64
Returns self
converted to Float64
.
Raises OverflowError
in case of overflow.
#to_f! : Float64
¶
: Float64
Returns self
converted to Float64
.
In case of overflow a wrapping is performed.
#to_f32 : Float32
¶
: Float32
Returns self
converted to Float32
.
Raises OverflowError
in case of overflow.
#to_f32! : Float32
¶
: Float32
Returns self
converted to Float32
.
In case of overflow a wrapping is performed.
#to_f64 : Float64
¶
: Float64
Returns self
converted to Float64
.
Raises OverflowError
in case of overflow.
#to_f64! : Float64
¶
: Float64
Returns self
converted to Float64
.
In case of overflow a wrapping is performed.
#to_i : Int32
¶
: Int32
Returns self
converted to Int32
.
Raises OverflowError
in case of overflow.
#to_i! : Int32
¶
: Int32
Returns self
converted to Int32
.
In case of overflow a wrapping is performed.
#to_i128 : Int128
¶
: Int128
Returns self
converted to Int128
.
Raises OverflowError
in case of overflow.
#to_i128! : Int128
¶
: Int128
Returns self
converted to Int128
.
In case of overflow a wrapping is performed.
#to_i16 : Int16
¶
: Int16
Returns self
converted to Int16
.
Raises OverflowError
in case of overflow.
#to_i16! : Int16
¶
: Int16
Returns self
converted to Int16
.
In case of overflow a wrapping is performed.
#to_i32 : Int32
¶
: Int32
Returns self
converted to Int32
.
Raises OverflowError
in case of overflow.
#to_i32! : Int32
¶
: Int32
Returns self
converted to Int32
.
In case of overflow a wrapping is performed.
#to_i64 : Int64
¶
: Int64
Returns self
converted to Int64
.
Raises OverflowError
in case of overflow.
#to_i64! : Int64
¶
: Int64
Returns self
converted to Int64
.
In case of overflow a wrapping is performed.
#to_i8 : Int8
¶
: Int8
Returns self
converted to Int8
.
Raises OverflowError
in case of overflow.
#to_i8! : Int8
¶
: Int8
Returns self
converted to Int8
.
In case of overflow a wrapping is performed.
#to_s : String
¶
: String
Returns a string representation of this object.
Descendants must usually not override this method. Instead,
they must override to_s(io)
, which must append to the given
IO object.
#to_s(io : IO) : Nil
¶
(io : IO) : Nil
Appends a String
representation of this object
to the given IO
object.
An object must never append itself to the io argument,
as this will in turn call to_s(io)
on it.
#to_u : UInt32
¶
: UInt32
Returns self
converted to UInt32
.
Raises OverflowError
in case of overflow.
#to_u! : UInt32
¶
: UInt32
Returns self
converted to UInt32
.
In case of overflow a wrapping is performed.
#to_u128 : UInt128
¶
: UInt128
Returns self
converted to UInt128
.
Raises OverflowError
in case of overflow.
#to_u128! : UInt128
¶
: UInt128
Returns self
converted to UInt128
.
In case of overflow a wrapping is performed.
#to_u16 : UInt16
¶
: UInt16
Returns self
converted to UInt16
.
Raises OverflowError
in case of overflow.
#to_u16! : UInt16
¶
: UInt16
Returns self
converted to UInt16
.
In case of overflow a wrapping is performed.
#to_u32 : UInt32
¶
: UInt32
Returns self
converted to UInt32
.
Raises OverflowError
in case of overflow.
#to_u32! : UInt32
¶
: UInt32
Returns self
converted to UInt32
.
In case of overflow a wrapping is performed.
#to_u64 : UInt64
¶
: UInt64
Returns self
converted to UInt64
.
Raises OverflowError
in case of overflow.
#to_u64! : UInt64
¶
: UInt64
Returns self
converted to UInt64
.
In case of overflow a wrapping is performed.
#to_u8 : UInt8
¶
: UInt8
Returns self
converted to UInt8
.
Raises OverflowError
in case of overflow.
#to_u8! : UInt8
¶
: UInt8
Returns self
converted to UInt8
.
In case of overflow a wrapping is performed.