From: Lionel Bouton Date: 2007-12-18T03:51:56+09:00 Subject: Re: dividing by two and rounding up Tom Norian wrote: > [...]I'm thinking perhaps I could test for oddness then add one to the result > if odd, but that seems kinda a lot of lines for something so simple. > > half_periods = 0 > if num_periods%2 == 1 > half_periods = num_periods/2 +1 > else > half_periods = num_periods/2 > end > > Is there a better way? > Something like this ? ((num_periods + 0.5)/2).round