"Add Unique" vector array adds duplicates anyway

Trying to add vectors to an array using Add Unique to avoid duplicates, but it add dupes anyway, and the “Find” function doesn’t find duplicates.

Both functions rendered useless by 6th decimal place fraction differences.
AddUnique

Had to do it manually with a for each loop and a boolean, is there a better way?

it could be a matter of comparison of floating points.

You could write a custom find that would override the operator== and instead of doing an exact comparison of floatA and floatB you could use the nearly equals function to get it to register with a set margin of error.

You’re absolutely right, it’s because of the floating point.
725.375514 does not trigger found with 725.375513.

This is what I ended up doing

And it works as desired, such a shame that a whole library no longer works due to such minor differences.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.