Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pnomolos
Copy link

@pnomolos pnomolos commented Feb 6, 2012

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.

….15000000000001. By passing the precision to to_d it will avoid the likelihood of a slight rounding error.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant