Module: ContinuedFractions::Numeric

Defined in:
lib/continued_fractions/include.rb

Instance Method Summary collapse

Instance Method Details

#to_cf(limit: ContinuedFraction::DEFAULT_LIMIT) ⇒ ContinuedFraction

Examples:

1.5.to_cf
=> 1.5, quotients: [1, 2], convergents: [(1/1), (3/2)]

Parameters:

  • limit (Float) (defaults to: ContinuedFraction::DEFAULT_LIMIT)

Returns:



10
11
12
# File 'lib/continued_fractions/include.rb', line 10

def to_cf(limit: ContinuedFraction::DEFAULT_LIMIT)
  ContinuedFraction.new(self, limit)
end