Logic Machine Forum
Math round with 2 decimal points - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Math round with 2 decimal points (/showthread.php?tid=5496)



Math round with 2 decimal points - joaodaniel.pereira - 04.07.2024

Hi,
It's possible with scripts to do a math.round with 2 decimal points ? 

best regards.


RE: Math round with 2 decimal points - admin - 04.07.2024

Two solutions:
Code:
value = 1.235

numvalue = math.round(value, 2) -- numeric value that can be used in further calculations
strvalue = string.format('%.2f', value) -- string value