Bug 162044 - Mention conversion to integer in documentation of function FACT
Summary: Mention conversion to integer in documentation of function FACT
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-15 14:26 UTC by Regina Henschel
Modified: 2024-07-30 05:33 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 Regina Henschel 2024-07-15 14:26:32 UTC
The function FACT requires an integer value as input. LibreOffice accepts non-integer values and converts such to integer values. But it does not document how it does it. It could be 'truncate' or 'round'.

The ODF standard states, "If the function or operator does not specify any particular conversion operation, then the conversion from a non-integer Number into an integer is implementation-defined."

And in case of functions, LibreOffice documents the 'implementation-defined' things in the online help.

So add something like "If a passed positive number is non-integer, it is truncated."
Comment 2 Regina Henschel 2024-07-15 15:53:47 UTC
Indeed. That makes is more complicate to describe.

FACT(4 - (1E-15)) is calculated as FACT(4).
FACT(4 - (1E-14)) is calculated as FACT(3).
Comment 3 Mike Kaganski 2024-07-15 17:06:14 UTC
(In reply to Regina Henschel from comment #2)

I don't think we should describe approxFloor in detail: I didn't mean that, I only tried to help by pointing, that it was effectively floor.

Indeed, FACT(4 - (1E-15)) is calculated as FACT(4). But also FACT(4 - (1E-25)) is calculated as FACT(4), even if for a different reason. The user-visible behavior is that the whole numbers (as they are displayed at least) are rounded toward negative infinity.
Comment 5 fpy 2024-07-25 11:18:05 UTC
others Integer functions (like LCM, ...) dont mention conversion either. 

So, maybe left to a more central place.
Comment 6 Mike Kaganski 2024-07-25 11:32:02 UTC
(In reply to fpy from comment #5)

I am not sure that we round identically everywhere... I'd start case-by-case first. Maybe create a template like "round to negative infinity", and start attaching to all such places. If there appears another rounding mode, we'd introduce another template.
Comment 8 Commit Notification 2024-07-26 13:25:35 UTC
Pierre F committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/56220af4577d0f685ca40595f7f57254f92628c4

adjust FACT. tdf#162044