Spherical formula returning NAN