Wrong currencies exchanges
Opened this issue · 0 comments
xxswingxx commented
Hi, some currencies are not correctly calculated. As far as I've tested converting a currency (EUR or USD) to Belarusian ruble (BYR) and Vietnamese dong (VND) adds extra digits to the integer part.
Money.new(100, "USD").exchange_to('USD').to_f # => 1.0 OK
Money.new(100, "USD").exchange_to('EUR').to_f # => 0.98 OK
Money.new(100, "USD").exchange_to('BYR').to_f # => 1427345.0 but should be 14273.45
Money.new(100, "USD").exchange_to('VND').to_f # => 2158000.0 but should be 21580.0
Nevertheless, the reverse operation gives a correct exchange:
Money.new(1427345.0, "BYR").exchange_to('USD').to_f # => 1.0
Money.new(2158000.0, "VND").exchange_to('USD').to_f # => 1.0