fix rounding issues with microseconds calculation #4476
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is:
Checklist:
Why this change is needed?
A bug was reported with rounding issues (#3899) that is said to be connected to #3677 and I also experience a failing test downstream, when a stored time of 13:37 is interpreted as 13:36 due to the same issues.
Modifications to the rounding strategies can vastly improve the situation by successfully testing existing cases as well as satisfying new tests, based on the failure I experience, as well as the test provided in #3899 (I included @BGehrels as co-author in that respective commits).
I did not play around much with the GMP extension, but this might also be an alternative for more precise calculation? With this here we lose the .1000000 part of a second, which however already suffers to inaccuracies, hence it is acceptable.
There is one failure I receive, though I suppose this is due to how I modified the test excel sheet. Tried with both LibreOffice as well as some MS Office Online thing, but it does not make a difference. The only (knowing) change i did was adding the time
13:37
to cellF3
and formatted it to show hours and minutes.