Slider calculations go wrong

I have a script attached to a box that makes the player lose 20% of his maximum health on touch.
This is the script:

public Slider health;

void OnCollisionEnter(Collision col){
	if(col.gameObject.tag=="Player"){
		health.value=health.value-0.2f;
		Debug.Log ("Hit "+health.value);
	}
}

After that I started checking this script and moved player the way he could hit the harm-box multiple times before he dies. And then goes the weird part.
Each time player needs 7 collisions to become fully dead and this is the result list of the health slider value after each hit:

  1. 0.8
  2. 0.6
  3. 0.4
  4. 0.2
  5. 2.980232E-08
  6. 0.1
  7. 0.0

Could anyone please explain me why is this happening?

Is there a reason that this value needs to be a float? can it not be represented by an int or something more simple?

I would assume the error does not lie within the code that you have posted and may lie in the health class.

Try it with an int instead of float. Float may be easier conceptually to think about, but there are nitty gritty things that come with that as well. If there is no specific reason to use float - use int.