From: Gunther Diemant Date: 2011-12-15T07:13:01+09:00 Subject: Re: round float to integer if whole number Possible tests: ff.floor == ff ff % 1 == 0 If x is always an integer i would use the mod operator ( x % w == 0 ==> x/w integer) 2011/12/14 Ronnie Aa : > Hi, > > I'm looking for a way to pick out the whole numbers (ff) in the function > below: > > > x = 17 > w = 4.000 > > while x > 0 > >  ff = x / w > >    if ff > 0 and ff.is_a? wholenumber >         puts " #{ff} is a whole number" >    end >  x -= 1 > > end > > Thanx > > Liquid > > -- > Posted via http://www.ruby-forum.com/. >