Skip to content

Vec3 equality issue #76

@jm-brennan

Description

@jm-brennan

I ran into a situation where I was doing a Vec3_i32.eql(a, b) comparison that was not giving the behavior that I expected. I could print vectors a and b and see that their data was the same, but the equality comparison would still fail. Doing an element by element comparison of a.x() == b.x() and a.y() == b.y() and a.z() == b.z() did provide the expected comparison behavior. I have used the eql function a lot up until now without issue, so I was/am confused.

An LLM suggested that the cause of this could be that for a vec 3 there will likely be a fourth element in the simd comparison to pad out the data, and that a discrepancy in that padded data could make the comparison fail even if the 3 values that actually matter are the same. I don't have enough experience with simd to know if that explanation is correct, but it seems plausible to me.

I like using this library, thanks for your work on it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions