datamapper / dm-validations

Library for performing validations on DM models and pure Ruby object
http://datamapper.org/
MIT License
50 stars 43 forks source link

Reduce the chance of a rounding error when converting Float to BigDecimal. #53

Open pnomolos opened 12 years ago

pnomolos commented 12 years ago

On Ruby 1.9.3 on OS X Lion, doing 67.15.to_d.to_s('F') will return 67.15000000000001. By passing the precision to to_d it will avoid the likelihood of a slight rounding error.