Calculating with fractions

Hey!
I got a problem in Processing. i want to define a variable to be 1/60. But if I look in the Console it always says, that the variable is 0. Last time I tried this (about one year ago) it worked perfectly. How do i fix this?

Hello,

Can you reproduce this?

You are doing integer math:
https://mathworld.wolfram.com/IntegerDivision.html

Try 1.0/60 and see what happens.

Make sure that you declare your variables correctly as well.

References:
https://processing.org/reference/int.html
https://processing.org/reference/float.html

:)

3 Likes

Thank you very much. It worked, but last time i tried this i didn´t had to write 1.0