Restrict function output to one or two significant figures

Hi folks.
Trying to restrict the output of a function node to one or two significant figures. With the lines below I get ridiculously long numbers. Any of you coding experts know what I can add to achieve this?

1 msg.payload = msg.payload/60 (something here)
2 return msg;

Thanks.

It's OK folks, I found the solution here from a previous post

[How can I limit a simple math function to 2 decimal places]

Are you doing this for display on a dashboard? If so, you should only round the number when you come to display it. Otherwise you lose precision.

In simple terms, leave the value as it is and only format it when you show it.

OK thanks for that Steve.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.