Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numeric to_money has rounding error #15

Closed
ghost opened this issue Jul 23, 2010 · 1 comment
Closed

numeric to_money has rounding error #15

ghost opened this issue Jul 23, 2010 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Jul 23, 2010

This test snippet fails...

amount = 555.55.to_money
assert_equal(Money.new(55555), amount)

Probably the error is in to ruby internal to_int method. "555.55".to_money works fine.

Here's the error message I get:
<#<Money:0x7f119cad3590
@bank=
#<Money::VariableExchangeBank:0x7f119e581a68
@mutex=#Mutex:0x7f119e5819f0,
@rates={},
@rounding_method=nil>,
@cents=55555,
@Currency=
#<Money::Currency id: usd priority: 1, iso_code: USD, name: United States Dollar, symbol: $, subunit: Cent, subunit_to_unit: 100, separator: ., delimiter: ,>>> expected but was
<#<Money:0x7f119cad35b8
@bank=
#<Money::VariableExchangeBank:0x7f119e581a68
@mutex=#Mutex:0x7f119e5819f0,
@rates={},
@rounding_method=nil>,
@cents=55554,
@Currency=
#<Money::Currency id: usd priority: 1, iso_code: USD, name: United States Dollar, symbol: $, subunit: Cent, subunit_to_unit: 100, separator: ., delimiter: ,>>>.

@semmons99
Copy link
Member

fixed in commit dfae9cf

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant