# rational.rb

Path: | rational.rb
Last Update: | Sat Jul 19 22:33:45 GMT+10:00 2003

      rational.rb -
          $Release Version: 0.5 $
          $Revision: 1.7 $
          $Date: 1999/08/24 12:49:28 $
          by Keiju ISHITSUKA(SHL Japan Inc.)

—

      Usage:
      class Rational < Numeric
         (include Comparable)

      Rational(a, b) --> a/b

      Rational::+
      Rational::-
      Rational::*
      Rational::/
      Rational::**
      Rational::%
      Rational::divmod
      Rational::abs
      Rational::<=>
      Rational::to_i
      Rational::to_f
      Rational::to_s

      Integer::gcd
      Integer::lcm
      Integer::gcdlcm
      Integer::to_r

      Fixnum::**
      Fixnum::quo
      Bignum::**
      Bignum::quo

## Methods

Rational

## Classes and Modules

Class Bignum
Class Fixnum
Class Integer
Class Rational

## Public Instance methods

Rational(a, b = 1)

      rational.rb -
          $Release Version: 0.5 $
          $Revision: 1.7 $
          $Date: 1999/08/24 12:49:28 $
          by Keiju ISHITSUKA(SHL Japan Inc.)

—

      Usage:
      class Rational < Numeric
         (include Comparable)

      Rational(a, b) --> a/b

      Rational::+
      Rational::-
      Rational::*
      Rational::/
      Rational::**
      Rational::%
      Rational::divmod
      Rational::abs
      Rational::<=>
      Rational::to_i
      Rational::to_f
      Rational::to_s

      Integer::gcd
      Integer::lcm
      Integer::gcdlcm
      Integer::to_r

      Fixnum::**
      Fixnum::quo
      Bignum::**
      Bignum::quo

[Source]

    # File rational.rb, line 39
    def Rational(a, b = 1)
      if a.kind_of?(Rational) && b == 1
        a
      else
        Rational.reduce(a, b)
      end
    end

[Validate]