struct BigFloat
- BigFloat
- Float
- Number
- Value
- Object
Overview
A BigFloat
can represent arbitrarily large floats.
It is implemented under the hood with GMP.
Included Modules
Defined in:
geometric/real.crConstructors
Instance Method Summary
-
#<=>(other : Real)
The comparison operator.
-
#sign : Int32
Returns the sign of this number as an
Int32
. - #to_degree
- #to_radian
Instance methods inherited from module Comparable(Float)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(BigFloat)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(Int)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(BigDecimal)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(BigRational)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(BigInt)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(BigFloat)
max(x : T)
max,
min(x : T)
min
Instance methods inherited from module Comparable(Number)
max(x : T)
max,
min(x : T)
min
Constructor Detail
Instance Method Detail
Description copied from module Comparable(Float)
The comparison operator. Returns 0
if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greter than other,
or nil
if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
def sign : Int32
#
Description copied from struct Number
Returns the sign of this number as an Int32
.
-1
if this number is negative0
if this number is zero1
if this number is positive
123.sign # => 1
0.sign # => 0
-42.sign # => -1