Derek Prior created JRUBY-6557:
----------------------------------

             Summary: Range#step does not accept float steps with integer ranges
                 Key: JRUBY-6557
                 URL: https://jira.codehaus.org/browse/JRUBY-6557
             Project: JRuby
          Issue Type: Bug
          Components: Ruby 1.8.7
    Affects Versions: JRuby 1.6.7
            Reporter: Derek Prior
            Priority: Minor


# MRI (1.8.7-p352, 1.9.2-p290):
(0..2).step(0.5).map {|x| x}
=> [0.0, 0.5, 1.0, 1.5, 2.0]

# JRuby 1.6.7:
(0..2).step(0.5).map {|x| x}
=> ArgumentError: step can't be 0.

# JRuby 1.6.7 --1.9
(0..2).step(0.5).map {|x| x}
=> [0.0, 0.5, 1.0, 1.5, 2.0]

It seem to coerce the float to an int. I believe this fails the following 
rubyspec:
https://github.com/rubyspec/rubyspec/blob/master/core/range/step_spec.rb#L98

The workaround is to provide the range also as a float.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to