# Math.js command to roud up or down

**URL:** <https://community.homey.app/t/math-js-command-to-roud-up-or-down/129495>\
**Category:** Questions & Help\
**Created:** [February 1, 2025, 8:05pm UTC](https://community.homey.app/t/math-js-command-to-roud-up-or-down/129495 "2025-02-01T20:05:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [February 1, 2025, 8:05pm UTC](https://community.homey.app/t/math-js-command-to-roud-up-or-down/129495/1 "2025-02-01T20:05:48Z")

</div>

I am using a logic card to round my value.  
Round() works fine

Looking at the math.js library it should be possible to round up or down by using  
**ceil()**  
**floor()**

But it does not seem to work.  
Any tips?

This even complete makes the app crash…  
The variable shows “empty” and when I select the variable it hangs  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/7/47e029b3538e405d39b4764cdef40f59656db258.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 1, 2025, 8:32pm UTC](https://community.homey.app/t/math-js-command-to-roud-up-or-down/129495/2 "2025-02-01T20:32:50Z")

</div>

Please omit the `math.` part from `math.floor`  
(That’s only needed in Better Logic mathjs calculations)

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [February 2, 2025, 9:55am UTC](https://community.homey.app/t/math-js-command-to-roud-up-or-down/129495/3 "2025-02-02T09:55:05Z")

</div>

Found out what I did wrong…

Round() can be used with number of decimal places  
Round(X,0).  
Thats what I was using.

I replaced _Round_ by _Ceil_, but Ceil(X,0) does not work…  
Removed the ,0 now its working fine
