Floating Point Bug???

I am trying to determine if vA and vB (both Vector3) are the same and the comparison fails when it should not. It fails because (vA-vB).x is 0.000000238 when it should be 0.0.

Printing vA, vB, vA-vB using ToString(“f50”) on each x,y,z gives:

vA:
(3.00000000000000000000000000000000000000000000000000,
5.00000000000000000000000000000000000000000000000000,
5.00000000000000000000000000000000000000000000000000)

vB:
(3.00000000000000000000000000000000000000000000000000,
5.00000000000000000000000000000000000000000000000000,
5.00000000000000000000000000000000000000000000000000)

vA-VB:
(0.00000023841860000000000000000000000000000000000000,
0.00000000000000000000000000000000000000000000000000,
0.00000000000000000000000000000000000000000000000000)

(vA-vB).magnitude == 2.35E-7; //is true

Mathf.Approximately((vA-vB).magnitude,0); //is false

I know there is floating point imprecision, but I would think that would be near Mathf.Epsilon, 1.401298E-45, not 2.35E-7.

Any tips on how to get around this issue? Anyone think its a bug?

Strange, I get 0.000… here, and likewise Mathf.Approximately((vA-vB).magnitude,0) is true.

–Eric

After looking through a lot of posts I came across one that mentions Vector3.kEpsilon.

The error I am having falls within this tolerance (1E-5).

I can test

(vA-vB).magnitude < Vector3.kEpsilon; // is true

I can not find kEpsilon anywhere except in 3 posts in the forums. Is this an isolated undocumented element or are the more similar elements that are undocumented or did I not search hard enough?