Bug 118596 - Calc equation =1/(MINUTE(TIME(7,30,0))-MINUTE(TIME(21,30,0))) gives divide by zero error
Summary: Calc equation =1/(MINUTE(TIME(7,30,0))-MINUTE(TIME(21,30,0))) gives divide by...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-06 22:34 UTC by Terry
Modified: 2018-07-07 02:32 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Terry 2018-07-06 22:34:42 UTC
Description:
=1/(MINUTE(TIME(7,30,0))-MINUTE(TIME(21,30,0))) gives divide by zero error.
=1/(MINUTE(TIME(7,30,0))-MINUTE(TIME(21,31,0))) gives a real answer.
It looks as though if the minute part of two times subtract to zero calc assumes the whole answer in minutes is zero for the purposes of recording a divide by zero error.
My work around has been to add one minute to the second time value which for my study is not significant.

Steps to Reproduce:
1.Start libre office calc
2. enter equation =1/(MINUTE(TIME(7,30,0))-MINUTE(TIME(21,30,0))) into cell
3.

Actual Results:
Divide by zero error

Expected Results:
a number 0.00 if cell format set to number with 2 decimal places.


Reproducible: Always


User Profile Reset: No



Additional Info:
Produced a value, 0.00 if cell format set to number with 2 decimal places.
Comment 1 Aron Budea 2018-07-07 02:32:12 UTC
Please note that MINUTE(...) function returns an integer between 0 and 59, ie. the minute part of the time.

If you want to calculate the difference between two times in minutes, you need to account for the hours as well (if the difference is less than a day, otherwise for days, too).