1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* variable.c (rb_mod_const_missing): new method. [ruby-core:00441]

* variable.c (rb_const_get_at): allow "const_missing" hook.

* variable.c (rb_const_get_0): ditto.

* eval.c (method_missing): rename from rb_undefined to clarify.

* eval.c (ruby_finalize_0): update exit status if any of END proc
  raises SystemExit. [ruby-core:01256]

* eval.c (rb_exec_end_proc): reduce rb_protect().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-07-22 08:42:47 +00:00
parent 27daa53c54
commit 0d1df1cd7d
7 changed files with 93 additions and 54 deletions

View file

@ -184,7 +184,7 @@ class Complex < Numeric
Complex.polar(r.power!(other), theta * other)
else
x, y = other.coerce(self)
x/y
x**y
end
end
@ -222,7 +222,7 @@ class Complex < Numeric
# plane.
#
def abs
Math.sqrt!((@real*@real + @image*@image).to_f)
Math.hypot(@real, @image)
end
#
@ -352,6 +352,7 @@ class Complex < Numeric
# The imaginary part of a complex number.
attr :image
alias imag image
end
@ -382,6 +383,7 @@ class Numeric
def image
0
end
alias imag image
#
# See Complex#arg.
@ -390,7 +392,7 @@ class Numeric
if self >= 0
return 0
else
return Math.atan2(1,1)*4
return Math::PI
end
end
@ -458,10 +460,12 @@ module Math
Complex(0,sqrt!(-z))
end
else
if defined? Rational
z**Rational(1,2)
if z.image < 0
sqrt(z.conjugate).conjugate
else
z**0.5
r = z.abs
x = z.real
Complex( sqrt!((r+x)/2), sqrt!((r-x)/2) )
end
end
end