From: John Joyce Date: 2007-07-20T04:42:03+09:00 Subject: Re: Float.to_int not working ?? On Jul 19, 2007, at 10:15 AM, Stefan Rusterholz wrote: > Lloyd Linklater wrote: >> print "#{((1.0 + 0.025)/0.0002 + 1.0).round.to_i} \n" > > Round already returns an integer, the .to_i is redundant ;-) > > Regards > Stefan > > -- > Posted via http://www.ruby-forum.com/. > For more accurate math, use really large integers and simply keep track of where you want your decimal. You wouldn't dare write an accounting application using floats, would you? If you absolutely must use floats for something, and you need greater accuracy, you should use something like C and its extra long float types, coupled with at least a 64 bit system, ideally go get an old PowerMac G5, its math coprocessor is 128 bits. It'll give you as good as you can get without buying a much more expensive machine or cobbling together a cluster of computers.