Jumping boolean check

I seen to hit a bug and I’m not sure how I go about fixing in. I’ve create a jump within the game which allows the sphere to go up couple of units as shown below, however if I jump and hit a wall my boolean check gets stuck and I’m unable to jump again for a couple of seconds. I’ve noticed that rigidbody.velocity.y doesn’t always return 0 and returns something -7.4050503E or something i’ve tried Mathf.Approximately(rigidbody.velocity.y, 0) but problem still occurs, any tips?

	if(grounded == false && rigidbody.velocity.y == 0) {
		grounded = true;
	}
	  
	if(Input.GetKeyDown(KeyCode.Space) && grounded == true) {
		rigidbody.AddForce(Vector3.up * jumpSpeed);
		grounded = false;
	}

This question has already been answered.

The second example on this page is testing for the distance to the ground:

http://docs.unity3d.com/ScriptReference/Physics.Raycast.html