https://bugs.documentfoundation.org/show_bug.cgi?id=97462
Lionel Elie Mamane <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|[email protected] |[email protected] |desktop.org | Summary|REPORT: Function SECONDS() |REPORT: Function SECONDS() |of a timefield will produce |of a timefield will |sometimes one second minor |sometimes produce one |than excepted |second less than expected --- Comment #6 from Lionel Elie Mamane <[email protected]> --- This basically comes from rounding issues. Internally a TimeValue is floating-point number, expressed as a number of days. The computation done is: 60 * fractionalPartOf(numberOfDays * 24 * 60) The result is then TRUNCATED to an integer. But the result sometimes is something like: 4.9999999999999999999999999999999999999999999999999999 which is then truncated to 4, while 5 is expected, because the ".9999999999999999999999999999999" comes from a rounding error, not from a time that is actually less than a second... I first thought of forcing a rounding to the nearest nanosecond, which works well because the rounding errors are well below the nanosecond (even rounding to 10^-15 works in my tests). However, I see that the OpenFormula specification calls for rounding to the nearest second anyway: http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#SECOND So I'll just do that. -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ Libreoffice-bugs mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
