From: Roger Pack Date: 2009-04-15T11:23:32+09:00 Subject: Re: a few thoughts for ruby... > 09:41:50 ~$ ruby19 x.rb > Float 0.00000000010000000827 > BigDecimal 0.00000000010000000000 > Float 0.00000000000000000827 > BigDecimal 0.00000000000000000000 > false > true > 09:41:52 ~$ cat x.rb Good examples. I should explain better my original thought perhaps--I don't actually want to convert "rounded" data but yes make it "cleaner" and "simpler" to make BigDecimals. I think I can achieve this by allowing for BigDecimal(float) but, similar to how String#to_s works currently in trunk: "only accept default values of floats" i.e. BigDecimal(0.9) => # >> BigDecimal((2.0-1.1).to_s) # 2.0-1.1 != 0.9 # BOOM not allowed, since that's a float that's been rounded away from its pure form (0.9's default form) You can ascertain this a la ("%g" % (2.0-1.1)).to_f != (2.0-1.1) # blow up in this case--those are rounded floats we don't want to convert them. Somewhat sane? -=r -- Posted via http://www.ruby-forum.com/.