rubinius/rubinius — Issue #1479: BigDecimal("NaN") is not subtracted from an array
Author: jc00ke
Created: 2011-12-31 07:35:38+00:00
State: open

I was looking into why `BigDecimal#divmod raises ZeroDivisionError if the divisor is zero` was failing and found a crazy little bug.

```ruby
require 'bigdecimal'

i = BigDecimal("Infinity")
ni = BigDecimal("-Infinity")
nan = BigDecimal("NaN")

specials = [i, ni, nan]
specials - [i] # => [ni, nan]
specials - [nan] # =>[i, ni, nan]
```
[divmod_spec.rb#L194](https://github.com/rubinius/rubinius/blob/0967ff532b9efb742a2590f0e0d62fc0872dee65/spec/ruby/library/bigdecimal/divmod_spec.rb#L194)

I think this might be an issue with IdentityMap, or possibly that `BigDecimal("NaN").hash == 0`?