Vector3 OrthoNormalize equality behaviour issue?

Why is it that the following use of Vector3.OrthoNormalize produces duplicate Vector3s in
a HashSet? It would appear that Vector3 equality comparison doesn’t behave quite right when one Vector3 is generated outside of OrthoNormalize and the other generated by OrthoNormalize… I’m mystified. Can anyone shed some light on this?

    private Vector3 _normal;
    private Vector3 _tangent;
    private Vector3 _binormal;

    public void TestOrthoNormalize() {
        HashSet<Vector3> uniqueVectors = new HashSet<Vector3>();
        Vector3[] coreVectors = { Vector3.forward, Vector3.right };

        foreach (var core in coreVectors) {
            _normal = core;
            Vector3.OrthoNormalize(ref _normal, ref _tangent, ref _binormal);
            uniqueVectors.Add(_normal);
            uniqueVectors.Add(_tangent);
            uniqueVectors.Add(_binormal);
        }

        foreach(var v in uniqueVectors) {
            Debug.Log(string.Format("Vector = {0}.", v));
        }

        // Produces:
        // Vector = (0.0, 0.0, 1.0).
        // Vector = (0.0, -1.0, 0.0).
        //  Vector = (1.0, 0.0, 0.0).   <-
        // Vector = (1.0, 0.0, 0.0).    <- 
        // Vector = (0.0, 0.0, -1.0).
    }

You should never compare float, since you can have precision error. You should define a custom IEqualityComparer to compare your Vector3.

Here’s a correct way to compare Vector3:

public static bool IsSameWith(Vector3 v0, Vector3 v1, float fEpsilon)
{
		if (Mathf.Abs(v0.x - v1.x) > fEpsilon)			
			return false;
		
		if (Mathf.Abs(v0.y - v1.y) > fEpsilon)
			return false;
		
		if (Mathf.Abs(v0.z - v1.z) > fEpsilon)
			return false;			     	
		     	
		return true;	     
}

More info on float comparaison