Bug #6864

bad value for range when using infinity with date or time

Added by slbug (Alex Grebennik) almost 8 years ago. Updated 12 months ago.

Target version:
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


Steps to reproduce:

require 'date', 1.0/0.0) # works, # fails, 1.0/0.0) # fails, # fails

Tested on 1.9.3 and trunk. I think this is a bug, because there is no logic error. just ranges without one bound.

Updated by slbug (Alex Grebennik) almost 8 years ago

And sometimes range behavior cant be understood -,

Updated by mame (Yusuke Endoh) almost 8 years ago

  • Status changed from Open to Assigned
  • Assignee set to tadf (tadayoshi funaba)
  • Target version set to 2.0.0

This is caused by the following behavior.

p <=> 1.0 #=> 1
p 1.0 <=> #=> nil

Funaba-san, what do you think?
It may be good to provide Date#coerce.

Yusuke Endoh

Updated by tadf (tadayoshi funaba) almost 8 years ago

this asymmetry is intentional.
i don't want to accept aNum + aDate.
Range's spec is variable.

Updated by mame (Yusuke Endoh) almost 8 years ago

  • Assignee changed from tadf (tadayoshi funaba) to matz (Yukihiro Matsumoto)
  • Target version changed from 2.0.0 to 2.6

I see, thank you. Then, addressing this issue requires
changing Range's spec, which is too heavy from this time.
I postpone this to next minor.

Yusuke Endoh


Updated by naruse (Yui NARUSE) over 2 years ago

  • Target version deleted (2.6)

Updated by jeremyevans0 (Jeremy Evans) 12 months ago

  • Status changed from Assigned to Closed

I think this issue is now solved by beginless and endless ranges.

Also available in: Atom PDF