Thanks Jeroen, Phrogz, Jason, Timothy and Gaurav and anybody who took the time to read that post. Got it sorted. As emphasised (sometimes I need a thing beaten into me), 'ceil' did the trick. Gaurav, interestingly, if I try your suggestion 10.0000000000000001 still gives me 10. Removing one of the zeros gives me the required 11. Must be to do with the number of places after the decimal point that are counted. Using SciTE rather than irb it seems to see even less places. I doubt that it would ever be an issue but good to know anyway. Thanks for your efforts. Been playing around with what you wrote and trying to understand what you did. Very interesting. Learned a lot from all your posts. Even that p can be written instead of puts! Wonderful support you give here. All the best Dermot gaurav bagga wrote: > hi, > > this might help > hope this is what you want and if i understood your point > just beautify the method try > > irb(main):008:0> def try(x) > irb(main):009:1> if Integer(x)==x > irb(main):010:2> p x > irb(main):011:2> else > irb(main):012:2* x=Integer(x)+1 > irb(main):013:2> p x > irb(main):014:2> end > irb(main):015:1> end > => nil > irb(main):016:0> try(10.0001) > 11 > => nil > irb(main):017:0> try(10.0) > 10.0 > => nil > irb(main):018:0> try(10) > 10 > => nil > irb(main):019:0> > > regards > gaurav v bagga >