From: Peter Vandenabeele Date: 2012-01-24T23:01:55+09:00 Subject: Re: Microrant on Ruy's Math Skills --20cf300fb11be128ca04b74696c5 Content-Type: text/plain; charset=UTF-8 On Tue, Jan 24, 2012 at 12:58 PM, Florian Gilcher wrote: ... > As for the discussion: this comes up every 6 months and the horse is > already > dead in the first mail. While I can certainly understand the frustration > with > float, the decision is made. Reverting it would mean touching every piece > of > software that does statistics. And in contrast to popular belief, there is > quite a lot of it out there. I know that at least 10 of my reporting > scripts > running at several clients offices would break, which would be > unacceptable for > me (expecially, because float is the correct datatype there). > Changing such a primitive in a language is reckless. > Ha, just discovering the 'to_d' function in 'bigdecimal/util' It's actually very close to what I wanted (15.78D): $ irb 1.9.3p0 :001 > require 'bigdecimal' => true 1.9.3p0 :002 > require 'bigdecimal/util' => true 1.9.3p0 :003 > a = "15.78".to_d => # 1.9.3p0 :004 > b = 2.to_d => # 1.9.3p0 :005 > a/b == 7.89.to_d => true 1.9.3p0 :006 > 1.234567890123.to_d => # I'm all set here :-) Peter --20cf300fb11be128ca04b74696c5--