[Libreoffice-bugs] [Bug 125580] Wrong value when adding two dates

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri May 31 12:12:39 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=125580

--- Comment #8 from Eike Rathke <erack at redhat.com> ---
First off, the expression  =FLOOR(NOW(), "00:05")  is not good practice, as the
second parameter to FLOOR() is expected to be a number, not a text string.
Whether a string will be automatically converted to a number and if and how
depends on the calculation settings under menu Tools -> Options -> Calc ->
Formula, Detailed Calculation Settings; the "00:05" may result in either
#VALUE! or 0 or 0.00347222222222222, the floating point value of TIME(0;5;0). A
correct expression would be =FLOOR(NOW();TIME(0;5;0)), however, whether a
significance of 0.00347222222222222 to FLOOR() yields an expected value is up
to the reader.. the start value in A1 then is 43616.5763888889

Adding 0.00347222222222222 repeatedly in a series leads to inaccuracy due to
cumulated rounding errors, this is in the nature of binary floating point
representation, for which precision is not endless, and independent of any
date+time formatting.

The difference between 6.2 and earlier versions is that for wall clock time
format displays the underlying value is not rounded anymore into the next
magnitude, same as a clock does not display 12:35 for a time of 12:34:56; you
can see in your attached sample if you format the values in column A as
YYYY-MM-DD HH:MM:SS.00
that starting from around A18 there's the value for example (today,now)
2019-05-31 15:34:59.99

For the expected calculation a working approach would be
=FLOOR(A1+TIME(0;5;0);TIME(0;5;0))
and pull that down.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190531/1736e622/attachment.html>


More information about the Libreoffice-bugs mailing list