# Calculating with fractions

**URL:** <https://discourse.processing.org/t/calculating-with-fractions/24546>\
**Category:** Beginners\
**Created:** [October 12, 2020, 2:45pm UTC](https://discourse.processing.org/t/calculating-with-fractions/24546 "2020-10-12T14:45:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Superkid](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Superkid](https://discourse.processing.org/u/Superkid)\
**Post date:** [October 12, 2020, 2:45pm UTC](https://discourse.processing.org/t/calculating-with-fractions/24546/1 "2020-10-12T14:45:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [October 12, 2020, 2:49pm UTC](https://discourse.processing.org/t/calculating-with-fractions/24546/2 "2020-10-12T14:49:10Z")

</div>

Hello,

> [@Superkid](#):
>
> Last time I tried this (about one year ago) it worked perfectly.

Can you reproduce this?

You are doing integer math:  
_[Integer Division -- from Wolfram MathWorld](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:  
_[int / Reference / Processing.org](https://processing.org/reference/int.html)_  
_[float / Reference / Processing.org](https://processing.org/reference/float.html)_

`:)`

---

<div class="post-metadata">

**Author:** ![Superkid](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Superkid](https://discourse.processing.org/u/Superkid)\
**Post date:** [October 12, 2020, 3:02pm UTC](https://discourse.processing.org/t/calculating-with-fractions/24546/3 "2020-10-12T15:02:56Z")

</div>

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