# Variable suddenly has a lot of decimals?!

**URL:** <https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545>\
**Category:** Questions & Help\
**Created:** [November 11, 2019, 9:28am UTC](https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545 "2019-11-11T09:28:39Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [November 11, 2019, 7:23pm UTC](https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545/21 "2019-11-11T19:23:29Z")

</div>

> [@Caseda](#):
>
> It isn’t actually a Homey bug, it is a general Javascript bug (the coding language Homey uses) that has been there ever since the language was developed.

I guess that Python suffers from that same “bug”:

```auto
Python 3.7.2 (default, Jan 28 2019, 12:25:20)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 0.2+0.4
0.6000000000000001

```

---

<div class="post-metadata">

**Author:** ![anon78407409](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon78407409](https://community.homey.app/u/anon78407409)\
**Post date:** [November 11, 2019, 8:57pm UTC](https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545/22 "2019-11-11T20:57:52Z")

</div>

Yup. We tested ourself at work, with exactly Python (2 and 3) both have the same issue with float.  
So hopefully Homey can circumvent it, although I do understand that it’s not the cause.

---

<div class="post-metadata">

**Author:** ![anon78407409](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon78407409](https://community.homey.app/u/anon78407409)\
**Post date:** [September 4, 2020, 2:16pm UTC](https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545/23 "2020-09-04T14:16:43Z")

</div>

I have to restart this thread. I’ve tried all the different suggestions here, but now I have an issue where it will turn on the thermostat to heat if I set the temperature from f.ex 15 to 16 degrees, while it’s still 22 in the room…?

If I go from 16 to 15 again, it will go off.

I discovered this as I’m trying to make it work with Google Neat Hub as well, where it would snap back to the old values and a lot of decimals.

This is run every time the target temperature (variable) is updated.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/a/9ab502a1219fc0a78b3191bbf7846f7f9a8860b0.jpeg)

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [September 5, 2020, 8:51pm UTC](https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545/24 "2020-09-05T20:51:36Z")

</div>

I use this method for round if i want 2 decimals

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/a/9ae917ddb17cd8b7f13b80b6ad41b7705141856d.jpeg)  
So , **2** gives 2 decimals **,3** gives 3 decimals

[Previous page](https://community.homey.app/t/variable-suddenly-has-a-lot-of-decimals/20545.md?page=1)
