# Runtime function calculation

**URL:** <https://community.appfarm.io/t/runtime-function-calculation/1666>\
**Category:** Bug reports\
**Tags:** function-editor\
**Created:** [February 21, 2025, 10:45am UTC](https://community.appfarm.io/t/runtime-function-calculation/1666 "2025-02-21T10:45:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![havardthun](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@havardthun](https://community.appfarm.io/u/havardthun)\
**Post date:** [February 21, 2025, 10:45am UTC](https://community.appfarm.io/t/runtime-function-calculation/1666/1 "2025-02-21T10:45:52Z")

</div>

It seems to me that there is an issue with calculating decimals starting with 0.

E.g: 0.5, 0.7

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/2X/4/4df93ddf89b10ab1f785f7f5a42249ab93acff61.png)

I think this worked just fine up until the newest release. We are calculating hours of work and half-hours of work is now interpreted as 0

---

<div class="post-metadata">

**Author:** ![Shahitha](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/shahitha/32/66_2.png) [@Shahitha](https://community.appfarm.io/u/Shahitha)\
**Post date:** [February 24, 2025, 8:10am UTC](https://community.appfarm.io/t/runtime-function-calculation/1666/2 "2025-02-24T08:10:16Z")

</div>

Hi,

I tried the same function on my end, but I wasn’t able to reproduce the issue you’re encountering. Are you still experiencing the same issue? If so, I can help with further troubleshooting.

---

<div class="post-metadata">

**Author:** ![havardthun](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@havardthun](https://community.appfarm.io/u/havardthun)\
**Post date:** [February 24, 2025, 9:52am UTC](https://community.appfarm.io/t/runtime-function-calculation/1666/3 "2025-02-24T09:52:28Z")

</div>

Yep. Still encountering the same issue.

I’ve set up contact directly with Rhys so hopefully we figure it out. One of us will update this post with solution to the issue!

Thanks

---

<div class="post-metadata">

**Author:** ![havardthun](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@havardthun](https://community.appfarm.io/u/havardthun)\
**Post date:** [February 24, 2025, 11:56am UTC](https://community.appfarm.io/t/runtime-function-calculation/1666/4 "2025-02-24T11:56:48Z")

</div>

I must have been very sloppy when reporting this on Friday. The code I reported as “not functioning” is working as intended.

I assume it did so on Friday as well.

Sorry to take up your time. This bug can be closed

---

<div class="post-metadata">

**Author:** ![rhys](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/rhys/32/1379_2.png) [@rhys](https://community.appfarm.io/u/rhys)\
**Post date:** [February 25, 2025, 8:05am UTC](https://community.appfarm.io/t/runtime-function-calculation/1666/5 "2025-02-25T08:05:49Z")

</div>

Some extra details for anyone who maybe encounters something similar in the future:

The problem here is the `parseFloat()` functionality in Javascript which converts strings to floats. This only looks for a dot separator e.g. 7.7 or 3.14. The floats in this case were stored with a comma separator, e.g. 1,5 or 2,0.

Since `parseFloat()` searches for dot values, it therefore cuts off the decimal part for all values with a comma, giving the “rounding down” effect. The solution is to use the function as shown in the screenshot, where commas are replaced with dots before using `parseFloat()`

For instance `let num1 = parseFloat(qty.replace(',','.'));`
