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

* range.c (range_step): iteration done using "+" if elements are

Numeric.  Otherwise using "succ".

* range.c (range_each): iteration done using "succ".  If the
  elements does not respond to "succ", raise TypeError.  As a
  result, all Enumerable methods, e.g. collect, require elements
  to respond to "succ'.

* range.c (range_member): comparison done using "each", if
  elements are non-Numeric or no-"succ" objects.  Otherwise
  compare using "<=>".

* range.c (Init_Range): remove "size" and "length".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-05-30 06:12:29 +00:00
parent 21b2953030
commit 34f5c4061c
5 changed files with 118 additions and 184 deletions

View file

@ -363,9 +363,10 @@ module Math
alias sin! sin
alias tan! tan
alias log! log
alias atan! atan
alias log10! log10
alias atan2! atan2
def sqrt(z)
if Complex.generic?(z)
if z >= 0