From: Martin DeMello Date: 2009-04-01T08:06:00+09:00 Subject: Re: Why does mathn kill this method? On Wed, Apr 1, 2009 at 4:16 AM, Siep Korteling wrote: > Really stumped here. > > def sum_digits(n) >    sum = 0 >    while n>0 >       sum += n % 10 >       n /= 10 >       end >    sum >  end > > STDOUT.sync=true > > puts sum_digits(12) #=> 3 > > require 'mathn' > puts sum_digits(12) # hangs n /= 10 just keeps making n into a smaller and smaller rational. it never reaches 0 martin