dz.utils.round (4.0,0) is not 4

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
renerene
Posts: 356
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

dz.utils.round (4.0,0) is not 4

Post by renerene »

dz.utils.round (4.0,0) is not 4 but 4.0
Is that correct? If so, what is an easy way to make 4 out of 4.0?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dz.utils.round (4.0,0) is not 4

Post by waaren »

renerene wrote: Sunday 24 May 2020 22:25 dz.utils.round (4.0,0) is not 4 but 4.0
Is that correct? If so, what is an easy way to make 4 out of 4.0?
Thx for reporting. need to look into that behavior but for now you can use math.floor(4.0)

or if 4.0 is a variable:

rawNumber = 4.0
math.floor(rawNumber + 0.5)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
renerene
Posts: 356
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: dz.utils.round (4.0,0) is not 4

Post by renerene »

thank you
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest