Notifications
Clear all

[Closed] dividing 1 with 100 is 0 why?

I have strange behaviour with maxcsript, when i want divide 1/100 he says that it is 0 do you know whre is the problem?

6 Replies

Because you devide integer with integer.

Try 1.0/100

Because you’re using integers so your result will be an integer. Make one of your numbers a float and it will return a float.

1/100 
0
1 as float/100
0.01
1/100 as float
0.01

thanks a lot guys

That can be an easy thing to forget about.
gotta watch out for the float/integer calculations.

That can be an easy thing to forget about.
gotta watch out for the float/integer calculations.

That can be an easy thing to forget about.
gotta watch out for the float/integer calculations.