[MacRuby] #1471: '0.0 % 0.0' should not raise exception, but should return NaN.

MacRuby ruby-noreply at macosforge.org
Sat Feb 25 20:10:28 PST 2012


#1471: '0.0 % 0.0' should not raise exception, but should return NaN.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  minor                 |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 {{{
 $ ruby19 -e 'p 0.0 % 0.0'
 NaN

 $ macruby -e 'p 0.0 % 0.0'
 -e:1:in `%': divided by 0 (ZeroDivisionError)
 }}}

 Test Script:
 {{{
 require 'test/unit/assertions.rb'
 include Test::Unit::Assertions

 assert_equal("NaN", (1.0 % 0.0).to_s)
 assert_raise(ZeroDivisionError){ 1.0.send(:%, 0.0) }

 assert_raise(ZeroDivisionError){ 1.0 % 0 }
 assert_raise(ZeroDivisionError){ 1.0.modulo(0.0) }
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1471>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list