def fix_numerical_instability(x):
    """Check whether x is close to zero, sqrt(0.5) or not. If it is close to
    these two values, changes x to the value. Otherwise, return x.
    """
    if np.allclose(0.0, x):
        return 0.0

    if np.allclose(np.sqrt(0.5), x):
        return np.sqrt(0.5)
    return x
Check whether x is close to zero, sqrt(0.5) or not. If it is close to
    these two values, changes x to the value. Otherwise, return x.
    
pymoo/vendor/gta.py