RubyMoney / money

A Ruby Library for dealing with money and currency conversion.
http://rubymoney.github.io/money
MIT License
2.73k stars 623 forks source link

Division by zero #1109

Open florin555 opened 2 months ago

florin555 commented 2 months ago

Is there a way to prevent division by zero?

I know there is a configuration for BigDecimal: BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, true).

That seems to have no effect on this: Money.new(1) / Money.new(0)

In addition, I would prefer to not have to change the behaviour of BigDecimal, as I don't know what other libraries might depend on that configuration. I would prefer to make the change at the money gem level.