Weird Node.position GetHashCode() issue

So I was using that Node.positon as a value in a HashSet (doing is as (Vector3) Node.position) as noticed that the HashSet was creating multiple entries of the same value (which is what using the HashSet data type is supposed to prevent). I decided to do some testing and when I do ((Vector3) Node.position).GetHashCode() and (new Vector3(1.5, 1.5, 0)).GetHashCode(), the one from Node.position is one value higher even those the value of the Vector3 is the same. I even logs out each x/y/z and they were actually the same so I don’t think it is a float point issue.

I have been able to work around the issue by always flooring the Vector’s x/y/z value and adding 0.5 to each (which results in the same value as before) but was wondering if you can think of anything that would cause this issue (I know this library uses a different type to represent a Vector3 data and though maybe the casting with that type is casing this somehow)?

It may be that the node’s corresponding Vector3 position is slightly different, for example Vector3(1.50000001, 1.5, -0.0000001). This will cause the hash code to be different.

I even logs out each x/y/z and they were actually the same so I don’t think it is a float point issue.

Log it with the “R” format specifier to print out everything. E.g.

1.500000000000001.ToString() == "1.5"
1.500000000000001.ToString("R") == "1.5000000000000011"