From: Phrogz Date: 2007-10-27T04:35:05+09:00 Subject: Re: Rounding to the nearest 0.05 On Oct 26, 1:19 pm, Peter Roome wrote: > Having difficulty figuring out where to begin with trying to round a > calculation to the nearest 0.05. Can anyone offer any suggestions > please? irb(main):016:0> 10.times{ irb(main):017:1* n = rand irb(main):018:1> rounded = (n * 20).round / 20.0 irb(main):019:1> puts "%.02f" % rounded irb(main):020:1> } 0.95 0.05 0.70 0.50 0.30 0.35 0.95 0.25 0.75 0.45