[MacRuby] #761: Integer 2 multiplication by self seems wrong
#761: Integer 2 multiplication by self seems wrong ----------------------------------+----------------------------------------- Reporter: ustc.lihui@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.6 Component: MacRuby | Keywords: multiply 2 ----------------------------------+----------------------------------------- code as follows: {{{ def f(a,i) if i<3 return 2 else v1=f(a,i-1) v2=f(a,i-2) v=v1*v2+a if v==0 printf "v1=%d,v2=%d,v=%d i=%d\n" ,v1,v2,v,i end return v end return 1 end s=Time.now n=11 v=f(0,n) t=Time.now-s printf "f(%d,%d)=%d,comsume time%10.5f seconds\n" ,0,n,v,t s=Time.now n=11 v=f(1,n) t=Time.now-s printf "f(%d,%d)=%d,comsume time%10.5f seconds\n" ,1,n,v,t }}} running it on ruby 1.8 & macruby 0.6,display: {{{ $ macruby f.rb v1=36028797018963968,v2=17179869184,v=0 i=11 f(0,11)=0,comsume time 0.014954 seconds f(1,11)=11568694537326272321321120595206,comsume time 0.000035 seconds $ ruby f.rb f(0,11)=618970019642690137449562112,comsume time 0.00022 seconds f(1,11)=11568694537326272321321120595206,comsume time 0.00019 seconds }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/761> MacRuby <http://macruby.org/>
#761: Integer 2 multiplication by self seems wrong ----------------------------------+----------------------------------------- Reporter: ustc.lihui@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: multiply 2 ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 0.6 => Comment: Reduction: {{{$ ./miniruby -e "p 36028797018963968 * 17179869184" 0 $ ruby -e "p 36028797018963968 * 17179869184" 618970019642690137449562112 }}} This sounds like a bug in the bignum promotion code path. -- Ticket URL: <http://www.macruby.org/trac/ticket/761#comment:1> MacRuby <http://macruby.org/>
#761: Integer 2 multiplication by self seems wrong ----------------------------------+----------------------------------------- Reporter: ustc.lihui@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: multiply 2 | ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.7 Comment: Added extra check in r4331 + verified that no significant perf regression was added. -- Ticket URL: <http://www.macruby.org/trac/ticket/761#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby