[MacRuby] #1281: Multiplication of ~32 bit integers giving incorrect results
MacRuby
ruby-noreply at macosforge.org
Tue May 17 20:17:24 PDT 2011
#1281: Multiplication of ~32 bit integers giving incorrect results
------------------------------+---------------------------------------------
Reporter: zgavin@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords:
------------------------------+---------------------------------------------
Multiplication of two integers around 32 bits in length can lead to what
appears to be a buffer overflow and incorrect results:
For example:
{{{
irb(main):001:0> ((2**32)-(2**29))*(2**32)
=> -2305843009213693952
irb(main):002:0> (2**32)*(2**32)
=> 0
irb(main):003:0> (2**32)*(2**32+2**31)
=> 27670116110564327424
}}}
Both of these are
--
Ticket URL: <http://www.macruby.org/trac/ticket/1281>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list