Project

General

Profile

Actions

Bug #4577

closed

(int...float).max should not raise an error

Added by yimutang (Joey Zhou) over 13 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:
-
ruby -v:
-
Backport:
[ruby-core:35754]

Description

=begin
(int...float).max (without a block) will raise an error:

(({p (1...9.3).max # cannot exclude non Integer end value (TypeError)}))

I don't think it should do so.

int...float is a valid range object. When I construct such range, there's no error message.

The range can call all the Range instance methods. Only when calling single #max, the errmsg seems to tell that the range itself is not valid.

#max with a block will not raise the error:

(({p (1...9.3).max {|a,b| a <=> b} #=> 9}))

I think (1...9.3).max should also return 9( (end_obj-1).ceil ). If you admit the legality of #max(&block), you should also admit #max().
=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #4591: (1.5...2).max #=> 1 (Range#max)Closedtarui (Masaya Tarui)04/21/2011Actions
Related to Ruby master - Bug #974: Range#max で終了しないことがあるClosed01/04/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0