struct BigFloat

Overview

A BigFloat can represent arbitrarily large floats.

It is implemented under the hood with GMP.

Included Modules

Defined in:

geometric/real.cr

Constructors

Instance Method Summary

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

def self.scan(scanner, io : IO) : self #

[View source]

Instance Method Detail

def <=>(other : Real) #
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]

[View source]
def sign : Int32 #
Description copied from struct Number

Returns the sign of this number as an Int32.

  • -1 if this number is negative
  • 0 if this number is zero
  • 1 if this number is positive
123.sign # => 1
0.sign   # => 0
-42.sign # => -1

[View source]
def to_degree #

[View source]
def to_radian #

[View source]