Closed smelesh closed 1 year ago
ratioOf assumes that the given amount has the same minor units as the current amount, otherwise the result is incorrect:
ratioOf
Money::EUR(20_00)->ratioOf(Money::JPY(1000))
expected: 0.02 actual: 2.00
Probably ratioOf should throw an exception when currencies don't match to avoid unexpected results.
Yes, it makes sense for ratioOf to throw an exception on unmatched currencies, especially that mod already does that. I made a PR.
mod
ratioOf
assumes that the given amount has the same minor units as the current amount, otherwise the result is incorrect:expected: 0.02 actual: 2.00
Probably
ratioOf
should throw an exception when currencies don't match to avoid unexpected results.