-
The Vector.Equals methods implementations are doing precisely comparison for float numbers. However, in many real-world calculations, we only care about the equality under an expected accuracy. For example, if I only care about an accuracy at scale of 0.001, so I wish the two following vectors are equal to each other: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
You can use
Is this what you're looking for? |
Beta Was this translation helpful? Give feedback.
-
@cdrnet Yes, thanks, and that's exactly what I want. Maybe it would be better to make them a overload of Equals() methods, but that's another issue. |
Beta Was this translation helpful? Give feedback.
-
With an enum as optional 3rd parameter to choose between absolute (default) and relative? |
Beta Was this translation helpful? Give feedback.
-
@cdrnet |
Beta Was this translation helpful? Give feedback.
You can use
AlmostEqual
for that effect: