sigrokproject / pulseview

Read-only mirror of the official repo at git://sigrok.org/pulseview. Pull requests welcome. Please file bugreports at sigrok.org/bugzilla.
http://sigrok.org/wiki/PulseView
GNU General Public License v3.0
488 stars 156 forks source link

Time Representation Error #71

Open Giles314 opened 3 months ago

Giles314 commented 3 months ago

Cross-compiling pulseview on fresh install of Linux Mint 6.8.0-38-generic the tests integrated in make raise two errors at lines 220 and 221 of test/util.cpp. the erroneous produced time representations were: ...:19:60 instead of ...:20:00 (line 220) ...:09:60 instead of ...:10:00 (line 221)

Checking the code it appears that it should work for these test lines if the type used to represent the numbers in the computation fulfills the following properties:

Usually integer and floats (with enough bit in mantis) are compliant. But the procedure works on Timestamp derived from boost::multiprecision::number. And apparently this type does not fulfill the property requirement. Though it increases the float representation precision, the integer representation are not mathematically perfect. The error is probably only 10^-24 of the target value but it is sufficient to trigger a decrement in floor function.