mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* math.c (Init_Math): backport asin, acos, atan.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
605ac74db3
commit
7c3537f27d
3 changed files with 44 additions and 3 deletions
|
@ -8,7 +8,7 @@
|
|||
# --
|
||||
# Usage:
|
||||
# class Rational < Numeric
|
||||
# (include Compareable)
|
||||
# (include Comparable)
|
||||
#
|
||||
# Rational(a, b) --> a/b
|
||||
#
|
||||
|
@ -47,7 +47,7 @@ class Rational < Numeric
|
|||
@RCS_ID='-$Id: rational.rb,v 1.7 1999/08/24 12:49:28 keiju Exp keiju $-'
|
||||
|
||||
def Rational.reduce(num, den = 1)
|
||||
raise ZeroDivisionError, "denometor is 0" if den == 0
|
||||
raise ZeroDivisionError, "denominator is 0" if den == 0
|
||||
|
||||
if den < 0
|
||||
num = -num
|
||||
|
@ -132,7 +132,7 @@ class Rational < Numeric
|
|||
den = @denominator * a.numerator
|
||||
Rational(num, den)
|
||||
elsif a.kind_of?(Integer)
|
||||
raise ZeroDivisionError, "devided by 0" if a == 0
|
||||
raise ZeroDivisionError, "divided by 0" if a == 0
|
||||
self / Rational.new!(a, 1)
|
||||
elsif a.kind_of?(Float)
|
||||
Float(self) / a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue