PDA

View Full Version : dividing 1 with 100 is 0 why?

 larex02-07-2012, 05:33 PMI have strange behaviour with maxcsript, when i want divide 1/100 he says that it is 0 do you know whre is the problem?
gandhics
02-07-2012, 05:53 PM
Because you devide integer with integer.

Try 1.0/100

SnipeyX
02-07-2012, 05:53 PM
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

larex
02-07-2012, 06:07 PM
thanks a lot guys :beer:

JokerMartini
02-08-2012, 12:10 AM
That can be an easy thing to forget about.
gotta watch out for the float/integer calculations.

JokerMartini
02-08-2012, 12:10 AM
That can be an easy thing to forget about.
gotta watch out for the float/integer calculations.

JokerMartini
02-08-2012, 12:11 AM
That can be an easy thing to forget about.
gotta watch out for the float/integer calculations.

CGTalk Moderation
02-08-2012, 12:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.