Need math or change

Hello,

I have a msg.payload with something like 130.33 e-42 and I want to have the decimal result 312.27, or rounded 312 back.
Do I have to use math for this?
Thanks in advance.
Tobias

Yes! Perhaps you should explain a little more.

I'm reading TCP-Modbus data out of a power-unit.
My payload is a number (picture) an I want to convert the payload to decimal value.

In your example you say you want 130.33 e-42 to display as 312.27, but I don't see in what way those numbers are related.
What does the Payload 1 function do?

Function "Payload 1" is just extracting the msg.payload[1]

The upper debug is the origin payload from the modbus, the socond after the "Payload1"

Note that 1.2317e-319 is actually a super small number of 0.0000[ with 300+zeros ]0012317

You would need to multiply by something to get a rounded integer but e-319 is so small that you can't just multiply it by 1e+319 (I get infinite or overflow)

The payload is a decimal value, a very small one, that is a 0.000000000 with318 zeroes 1257. Are you sure you are reading data correctly and that your calculation in the function node is correct?
[edit] @jtmoderate876 beat me to it!

1.2317e-319 is in math (1.2317*e) -319 = -315.651892272

I believe you have it wrong and that is not correct.

But in JavaScript, 1.2317e-391 is 1.2317 * 10^-391

The debug window shows the direct numerical representation, in scientific mode for the exponent. What you’re referencing is Euler’s number, the mathematical constant e. The number displayed in the debug window is however not a mathematical representation of a formula, but just a number.

1 Like