facontidavide / PlotJuggler

The Time Series Visualization Tool that you deserve.
https://www.plotjuggler.io
Mozilla Public License 2.0
4.22k stars 588 forks source link

Floating point truncated exception when loading bag with messages with INT64 fields with values bigger than std::numerical_limits<double>::max #903

Open mme2lr-bosch opened 6 months ago

mme2lr-bosch commented 6 months ago

Problem description

When loading a bag which contains messages with INT64 fields whose values are bigger than std::numerical_limits<double>::max, a "Floating point truncated" execption is thrown:

Steps to reproduce (important)

Root Cause Analysis

When loading the bag, the function member function convert() is called for a Variant object which contains the too big INT64 value in _storage.raw_data[0]. In LOC 359, this value is converted to double using the convert_impl function with template arguments SRC equal to int64_t and DST as double.

This function is implemented in converstion_impl.hpp and checks if the conversion can be done exactly and throws a RangeException otherwise in LOC 334

Since the max value of INT64 is bigger than the max value of double, this can happen for messages with INT64 field with too big values.

Problem cannot be reproduced with dummy data

Minimal bag to reproduce problem: fake_int64_data.zip

facontidavide commented 6 months ago

PlotJuggler can only manage numbers that can be represented as double.

What would be the desired behavior in this case? Truncation? There is no other solution

mme2lr-bosch commented 6 months ago

Ok.

I think a pragmatic workaround would be to ignore the series which contain such values. This would at least allow us to visualize the rest of the bag.

facontidavide commented 6 months ago

that will take me considerable more time than simply remove the exception. I will do it once I have time. Feel free of course to create a PR to fix this

mme2lr-bosch commented 6 months ago

Ok, thanks. I assume simply removing the exception is not something you would merge to master, right?

facontidavide commented 6 months ago

I guess I might, since I received this complaint more time than I can count.