From: Chad Perrin Date: 2012-01-24T02:45:04+09:00 Subject: Re: Microrant on Ruy's Math Skills On Mon, Jan 23, 2012 at 07:33:20PM +0900, Peter Vandenabeele wrote: > > Feature request: > > Based on this discussion, it would actually be useful to me if I could > shorten this: > > amount = BigDecimal.new("15.5") > > to > > amount = 15.5B > > Then we could also answer future questions about > > "How come 1.1 - 1.0 != 0.1 ??" > > with > > "1.1B - 1B == 0.1B" Even that and the '1.1'.to_dec option mentioned elsewhere seem pretty cumbersome when working with a lot of numbers. How difficult would it be to change the way Ruby parses 1.1 within a given program so it just automatically uses BigDecimal rather than Float? That way, one could just tell Ruby to use BigDecimal instead of Float by default at the top of the program file and go forward confident that Float errors will not creep into the program (unless using a library that explicitly uses floating point numbers within itself). -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]