class TTFunk::SciForm

Attributes

exponent[R]
significand[R]

Public Class Methods

new(significand, exponent = 0) click to toggle source
# File lib/ttfunk/sci_form.rb, line 8
def initialize(significand, exponent = 0)
  @significand = significand
  @exponent = exponent
end

Public Instance Methods

==(other) click to toggle source
# File lib/ttfunk/sci_form.rb, line 17
def ==(other)
  case other
  when Float
    other == to_f # rubocop: disable Lint/FloatComparison
  when self.class
    other.significand == significand &&
      other.exponent == exponent
  else
    false
  end
end
Also aliased as: eql?
eql?(other)
Alias for: ==
to_f() click to toggle source
# File lib/ttfunk/sci_form.rb, line 13
def to_f
  significand * 10**exponent
end