strange maths division error-unityscript

if I write — var size1 : float= 1/(44-1);

it’s equals 0

				var size1 : float = 1/(size -1);
				if ( x ==20 ){ Debug.Log(  "size   "+ size +  "  divider "  + size1*1000  );}

prints this:

         size   44  divider 0

It’s not an error, it’s expected behavior because you’re using integer division. Making the variable a float doesn’t cause Unity use float division when all of the numbers involved in the division are integers. So you need to make at least one of the numbers a float.

It looks like integer math is taking place. If you make either number a float first you will get the proper output.

var size1:float = 1.0/(size - 1);
if(x==20)Debug.Log( "size   "+ size +  "  divider "  + size1*1000  );