ruby-numo / numo-narray

Ruby/Numo::NArray - New NArray class library
http://ruby-numo.github.io/narray/
BSD 3-Clause "New" or "Revised" License
415 stars 41 forks source link

Numo::RObject indexed by Numo::Bit setting wrong value with nil #162

Closed ankane closed 4 years ago

ankane commented 4 years ago
require "numo/narray"

a = Numo::RObject.cast([1, 2, 3])

a[Numo::Bit.cast([0, 1, 0])] = "hi"
p a[1] # "hi"
a[Numo::Bit.cast([0, 1, 0])] = -1
p a[1] # -1
a[1] = nil
p a[1] # nil
a[Numo::Bit.cast([0, 1, 0])] = nil
p a[1] # 0 

The last example sets the a[1] to 0 instead of nil.

ankane commented 4 years ago

Thanks @masa16, looks like it's fixed on master.