class TTFunk::SciForm
Scientific number representation
Attributes
Exponent @return [Float, Integer]
Significand @return [Float, Integer]
Public Class Methods
Source
# File lib/ttfunk/sci_form.rb, line 16 def initialize(significand, exponent = 0) @significand = significand @exponent = exponent end
@param significand [Float, Integer] @param exponent [Float, Integer]
Public Instance Methods
Source
# File lib/ttfunk/sci_form.rb, line 32 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
Check equality to another number.
@param other [Float, SciForm] @return [Boolean]
Also aliased as: eql?
Source
# File lib/ttfunk/sci_form.rb, line 24 def to_f significand * (10**exponent) end
Convert to Float.
@return [Float]