Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box space equality is not correct #21

Open
v-i-s-h opened this issue Apr 19, 2019 · 1 comment
Open

Box space equality is not correct #21

v-i-s-h opened this issue Apr 19, 2019 · 1 comment

Comments

@v-i-s-h
Copy link

v-i-s-h commented Apr 19, 2019

Box space with different datatypes are compared to be equal if range is same.
MWE:

julia> box1 = Box(0, 255, (1,), Float32)
Box(Float32[0.0], Float32[255.0], (1,), Float32)

julia> box2 = Box(0, 255, (1,), UInt8)
Box(UInt8[0x00], UInt8[0xff], (1,), UInt8)

julia> sample(box1)
1-element Array{Float32,1}:
 168.51285

julia> sample(box2)
1-element Array{UInt8,1}:
 0x7d

julia> box1 == box2
true    # <--- This should be false!!

Maybe we should make Box(0, 255, (1,), UInt8) != Box(0, 255, (1,), UInt16) and Box(0, 255, (1,), UInt8) != Box(0, 255, (1,), Int8) as the return data type may cause typeistability down the line.

@kraftpunk97-zz
Copy link
Contributor

kraftpunk97-zz commented Apr 20, 2019

Good point. While I agree with Box(0, 255, (1,), UInt8) != Box(0, 255, (1,), Int8), I'm not so sure about Box(0, 255, (1,), UInt8) != Box(0, 255, (1,), UInt16). I mean (and I may be completely wrong about this), a sample(Box(0, 255, (1,), UInt8)) in Box(0, 255, (1,), UInt16) should always be true, and vice versa. That should make Box(0, 255, (1,), UInt8) == Box(0, 255, (1,), UInt16) imo. But I'd defer to you and @tejank10, because I may be out of my depth here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants