Revision 6da58123e61145bee8e9478461c9505887aeb050 authored by Gregor MacDougall on 07 January 2019, 23:19:47 UTC, committed by Anthony Dmitriyev on 07 January 2019, 23:19:47 UTC
This leads to an error when attempting to allocate a zero value, and the zero value is the first argument in parts. Example: ``` [1] pry(main)> Money.new(100, "USD").allocate([1, 1, 0]) => [#<Money fractional:50 currency:USD>, #<Money fractional:50 currency:USD>, #<Money fractional:0 currency:USD>] [2] pry(main)> Money.new(100, "USD").allocate([0, 1, 1]) ZeroDivisionError: divided by 0 [3] pry(main)> Money.new(100, "USD").allocate([1, 1, 0.0]) => [#<Money fractional:50 currency:USD>, #<Money fractional:50 currency:USD>, #<Money fractional:0 currency:USD>] [4] pry(main)> Money.new(100, "USD").allocate([0.0, 1, 1]) FloatDomainError: NaN ```
1 parent 0ac7cf4
File | Mode | Size |
---|---|---|
config | ||
lib | ||
spec | ||
.coveralls.yml | -rw-r--r-- | 46 bytes |
.gitignore | -rw-r--r-- | 182 bytes |
.rspec | -rw-r--r-- | 30 bytes |
.travis.yml | -rw-r--r-- | 505 bytes |
AUTHORS | -rw-r--r-- | 1.8 KB |
CHANGELOG.md | -rw-r--r-- | 25.1 KB |
CONTRIBUTING.md | -rw-r--r-- | 492 bytes |
Gemfile | -rw-r--r-- | 411 bytes |
LICENSE | -rw-r--r-- | 1.1 KB |
README.md | -rw-r--r-- | 17.5 KB |
Rakefile | -rw-r--r-- | 313 bytes |
money.gemspec | -rw-r--r-- | 1.3 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...