https://bugs.freedesktop.org/show_bug.cgi?id=69552

          Priority: medium
            Bug ID: 69552
          Assignee: [email protected]
           Summary: Function FLOOR inconsistent with OpenFormula
                    specification
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: [email protected]
          Hardware: Other
            Status: UNCONFIRMED
           Version: 4.1.1.2 release
         Component: Spreadsheet
           Product: LibreOffice

Created attachment 86114
  --> https://bugs.freedesktop.org/attachment.cgi?id=86114&action=edit
Test file

OASIS Open Document Format for Office Applications (OpenDocument) Version 1.2 -
Part 2: Recalculated Formula (OpenFormula) Format, part 6.17.3 FLOOR:

> Summary: Round a number N down to the nearest multiple of the second 
> parameter,
> significance.
> Syntax: FLOOR( Number N [ ; [ Number significance ] [ ; Number mode ] ] )
> Returns: Number
> Constraints: Both N and significance shall be numeric and have the same sign.
>Semantics: Rounds a number down to a multiple of the second number. If 
>significance
> is omitted or an empty parameter (two consecutive ;; semicolons) it is 
> assumed to be
> -1 if N is negative and +1 if N is non-negative, making the function act like 
> the normal
> mathematical floor function if mode is not given or zero. If mode is given 
> and not equal
> to zero, the absolute value of N is rounded away from zero to a multiple of 
> the absolute
> value of significance and then the sign applied. Otherwise, it rounds toward 
> negative
> infinity, and the result is the largest multiple of significance that is less 
> than or equal
> to N. If any of the two parameters N or significance is zero, the result is 
> zero.
> Note: Many application user interfaces have a FLOOR function with only two 
> parameters, and
> somewhat different semantics than given here (e.g., they operate as if there 
> was a non-zero mode
> value). These FLOOR functions are inconsistent with the standard mathematical 
> definition of FLOOR.

Given these guidelines, the LO FLOOR implementation incorrectly handles omitted
second parameter (Significance): if FLOOR is used with only one parameter (like
in "=FLOOR(5)"), the function returns Err:511 Variable missing, and if there
are consequitive semicolons, like in "=FLOOR(5;)" or "=FLOOR(5;;)" or
"=FLOOR(5;;1)", it gives zero, as if the second parameter were zero. Shis
contradicts with the second sentence of "Semantics" clause of standard cited
above.

Tested with 4.1.1.2 under Win7x64

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to