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

          Priority: medium
            Bug ID: 73410
          Assignee: [email protected]
           Summary: Wrong results from rounding functions for large
                    argument
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: [email protected]
          Hardware: All
            Status: UNCONFIRMED
           Version: 3.5.7.2 release
         Component: Libreoffice
           Product: LibreOffice

Created attachment 91706
  --> https://bugs.freedesktop.org/attachment.cgi?id=91706&action=edit
Calc spreadsheet to demonstrate rounding errors for large argument values

This report concerns LibreOffice Calc; functions roundup, rounddown, trunc,
ceiling, floor, int, even and odd.

A minimal set of instructions to reproduce the core of the problem follows.
Open a new blank spreadsheet. In the A1 cell enter "=power(2,50)+1" (without
the quotes) and in the B1 cell enter "=rounddown(a1,0)-a1" (without the
quotes). Expected result: B1=0. Actual result: B1=5.

More generally, let y=power(2,50)+1. I expect that rounding y to integer will
return y exactly, for any of the functions roundup, rounddown, trunc, ceiling,
floor and int. I also expect that even(y)=y+1 and odd(y)=y.

Actual results: functions roundup(y,0), rounddown(y,0), trunc(y,0),
ceiling(y,1), floor(y,1) and int(y) all return y+5. Moreover, even(y)=y and
odd(y)=y+6 according to Calc.

(Note that the second argument to roundup, rounddown and trunc indicates number
of places behind the decimal symbol and the second argument to ceiling and
floor indicates the unit.)

There are similar problems with these rounding functions when rounding to some
number (>0) of places behind the decimal symbol.

The attached spreadsheet illustrates the issue. I have highlighted in yellow
the cells where the result is different from what is expected. Row 5 shows the
precise results described here; other rows show similar calculations for values
y=power(2,x)+1 for other values of x.

-- 
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