09.05.2022, 09:15
Hi,
I'm facing an issue with a POST request and its return value.
I'm sending a POST request to a device and it replay with a payload containing a number.
this number is like:
1000000012345685
LUA automatically converts to scientific notation and shown as 1.00000001234568e+15
the issue cames during its back fortmat to string/number:
string.format('%.0f',1.00000001234568e+15) >> 1000000012345680
AND NOT 1000000012345685.
this invalidate my other function that is supposed to use the right number.
Actually the issue seems to be LUA itself that truncate to 14 decimals
Considering that there is no way to get the POST request as tring, is there a way to:
- Forse LUA to use 15 decimals in autoconversion
- Disable the automatic scientific notation
Thanks
ciao
M
I'm facing an issue with a POST request and its return value.
I'm sending a POST request to a device and it replay with a payload containing a number.
this number is like:
1000000012345685
LUA automatically converts to scientific notation and shown as 1.00000001234568e+15
the issue cames during its back fortmat to string/number:
string.format('%.0f',1.00000001234568e+15) >> 1000000012345680
AND NOT 1000000012345685.
this invalidate my other function that is supposed to use the right number.
Actually the issue seems to be LUA itself that truncate to 14 decimals
Considering that there is no way to get the POST request as tring, is there a way to:
- Forse LUA to use 15 decimals in autoconversion
- Disable the automatic scientific notation
Thanks
ciao
M