strange values ​​of some numerical parameters

Niko Lynca year ago

In Traccar modern, some numerical values ​​are displayed in a strange way, e.g. the value of the Power - it is usually displayed correctly, but in some messages the value looks like this: 12.7480000000000001 which does not look very nice, e.g. in popup or reports.

Initially, I thought that the trackers was sending it this way, but I noticed that the problem occurs for various trackers and protocols, e.g. Teltonika, Queclink

I also checked a specific AVL package from the Teltonika device where in Traccar the value of the power parameter showed up as 12.7480000000000001 V

000000000000002908010000018b7d506a40000b68381b1e444f3000000000000000000301ef00024231cc430f6000000100004272

The value of io66 is 31CC which corresponds exactly to 12748, so something wrong is happening on the Traccar side during decoding or conversion

In the old interface it was automatically rounded to two decimal places so the problem was not noticeable. (However, Excel reports have this problem in both cases)

I know, this can be bypassed using CA e.g. (math:round(power*100))/100.00, but I am curious whether this is a known problem and whether such rounding for attributes can be set globally in the configuration file.

Anton Tananaeva year ago

I recommend reading this if you're not familiar with floating point numbers:

https://floating-point-gui.de/

Niko Lynca year ago

Ok, I understand what this means, but is there any option in the configuration file to not display so many decimal places? So that it would be shown as in the old interface?

Anton Tananaeva year ago

No, but we should really round it up in the UI.