Bug 153139 - Incorrect calculation of times
Summary: Incorrect calculation of times
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.4.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-21 10:38 UTC by retired
Modified: 2023-10-19 03:15 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
the expanded formula. unfortunately, you cannot debug step by step (85.78 KB, image/png)
2023-01-21 10:40 UTC, retired
Details

Note You need to log in before you can comment on or make changes to this bug.
Description retired 2023-01-21 10:38:03 UTC
Description:
I want the time of R4 (see image) to appear in Q4 rounded down to the half hour. Only, I suppose because of the miscalculated remainder, in the case of only 30 minutes instead of giving 0 it gives a higher value. Even with -30 it gives an error. It works correctly up to 29 minutes and from 31 and up, even at 1:30 it works.
Yet I tried doing the same calculations in a separate file, one calculation per column, and there it works correctly.
Curiously to create the test file I tried multiplying by constant numbers the cell containing 1 minute to get the other values, both positive and negative case, but I was getting error.

Steps to Reproduce:
Create a file with the same data and formula.
The value of P is entered by hand. The value of Q is calculated by addition and subtraction.

Actual Results:
In case of 0:30 the calculation of the remainder is wrong, in all other cases it is correct.
If I write 0:30:01 the calculation becomes correct, but doing so would change other calculations and I think it should work correctly in the case of 30 minutes as well.

Expected Results:
The remainder of the division between 0:30 and 0:30 should be zero


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Right now I don't have that information available because I don't have access to the computer where that file is stored.
And it is not possible to save the bug report in order to access that computer.
I also find it inappropriate to publish my email address and if I could write in my own language it would be much easier to describe the problem.
Comment 1 retired 2023-01-21 10:40:43 UTC
Created attachment 184820 [details]
the expanded formula. unfortunately, you cannot debug step by step
Comment 2 ady 2023-01-21 12:37:38 UTC
(In reply to apprendista.programmatore+Bugzilla from comment #0)

> I want the time of R4 (see image) to appear in Q4 rounded down to the half
> hour. Only, I suppose because of the miscalculated remainder, in the case of
> only 30 minutes instead of giving 0 it gives a higher value. Even with -30
> it gives an error. It works correctly up to 29 minutes and from 31 and up,
> even at 1:30 it works.

I think the problem is how that specific cell with "00:30" is being interpreted: Calc is not taking it as "half an hour" (i.e. a time-difference) but rather "12:30 AM" (i.e. a time of the day).

"12:30 AM" would translate to "50/2400" (0.0208333333333333), whereas "half an hour" would be "1/2" (0.5).

Since ATM there is no spreadsheet file attached, I am only making assumptions.

Can you please confirm all this?
Comment 3 Werner Tietz 2023-01-21 14:28:59 UTC
use the Formula:

=FLOOR(R4;1/48)
Comment 4 retired 2023-01-23 18:03:25 UTC
Version: 7.4.4.2 (x64) / LibreOffice Community
Build ID: 85569322deea74ec9134968a29af2df5663baa21
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: threaded
Comment 5 retired 2023-01-23 18:06:44 UTC
I try edit the formula in
=IF(P4<>"";Q4-MOD(FLOOR(Q4;$X$1/2*SIGN(Q4));1/48);"")

But now in R it copies the minutes of Q always. At least, I tried 29:00 and got 29:00 not 0.

What I want to achieve is to separate the whole half hours from the minutes, in other words:
if P4 is valorized do the calculations, otherwise nothing
if it is 0 I hide with formatting, so I don't put it in formula
tmp=resto division(time, 30:00)
write Q-tmp
hope I didn't confuse

The crazy thing is that if I remove the formula part of the initial if, it works correctly, only it shows error if P is empty
Comment 6 Buovjaga 2023-03-21 13:20:39 UTC
Please attach an example document.
Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the document.
Comment 7 QA Administrators 2023-09-18 03:06:16 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2023-10-19 03:15:26 UTC
Dear apprendista.programmatore+Bugzilla,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp