Bug 154797 - ROUNDUP and ROUNDDOWN Function may not match when Count Section is zero or omitted.
Summary: ROUNDUP and ROUNDDOWN Function may not match when Count Section is zero or om...
Status: RESOLVED DUPLICATE of bug 154792
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.5.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-13 22:00 UTC by nobu
Modified: 2023-04-15 22:25 UTC (History)
0 users

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 nobu 2023-04-13 22:00:44 UTC
Description:
ROUNDUP and ROUNDDOWN Function may not match when Count Section is zero or omitted.

Steps to Reproduce:
1. Open New Calc
2. Input
=ROUNDDOWN(100000000000.9 ; 0)
or
=ROUNDUP(100000000000.1 ; 0)

Actual Results:
3.
=ROUNDDOWN(100000000000.9 ; 0) -> 100000000001
=ROUNDUP(100000000000.1 ; 0)   -> 100000000000

Expected Results:
3.
=ROUNDDOWN(100000000000.9 ; 0) -> 100000000000
=ROUNDUP(100000000000.1 ; 0)   -> 100000000001



Reproducible: Always


User Profile Reset: No

Additional Info:
The following is a comparison between the case of zero and omitted.

=ROUNDDOWN(100000000000.9 ; 0) -> 100000000001
=ROUNDDOWN(100000000000.9)     -> 100000000000

=ROUNDUP(100000000000.1 ; 0)   -> 100000000000
=ROUNDUP(100000000000.1)       -> 100000000001

---
Reference help
https://help.libreoffice.org/7.5/en-US/text/scalc/01/04060106.html

ROUNDUP
If Count is omitted or zero, the function rounds up to an integer.

---
Even if there is a problem with accuracy, it must be the same value in this case.

It looks correct if the Count Section is omitted.

---
Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 4; OS: Windows 10.0 Build 10240; UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: threaded

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: fc6806c4be8585ce0d35a6b581bf8b3dbf858500
CPU threads: 4; OS: Windows 10.0 Build 10240; UI render: default; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: threaded
Comment 1 Mike Kaganski 2023-04-13 22:15:08 UTC

*** This bug has been marked as a duplicate of bug 154792 ***
Comment 2 nobu 2023-04-13 23:52:55 UTC
=ROUNDUP(1000000000000001)    -> 1000000000000001
=ROUNDUP(1000000000000001,0)  -> 1000000000000001
=ROUNDUP(1000000000000001,-1) -> 1000000000000010
=ROUNDUP(1000000000000001,-2) -> 1000000000000100
=ROUNDUP(1000000000000001,-3) -> 1000000000001000
=ROUNDUP(1000000000000001,-4) -> 1000000000000000  -- ?

=ROUNDUP(1000000000000005,-4) -> 1000000000010000

=ROUNDUP(100000000000001,-4) -> 100000000010000
Comment 3 nobu 2023-04-13 23:56:52 UTC
(In reply to nobu from comment #2)
> =ROUNDUP(1000000000000001)    -> 1000000000000001
> =ROUNDUP(1000000000000001,0)  -> 1000000000000001
> =ROUNDUP(1000000000000001,-1) -> 1000000000000010
> =ROUNDUP(1000000000000001,-2) -> 1000000000000100
> =ROUNDUP(1000000000000001,-3) -> 1000000000001000
> =ROUNDUP(1000000000000001,-4) -> 1000000000000000  -- ?
> 
> =ROUNDUP(1000000000000005,-4) -> 1000000000010000
> 
> =ROUNDUP(100000000000001,-4) -> 100000000010000

I posted it again by mistake. The following is correct.

=ROUNDUP(1000000000000001)    -> 1000000000000001
=ROUNDUP(1000000000000001;0)  -> 1000000000000001
=ROUNDUP(1000000000000001;-1) -> 1000000000000010
=ROUNDUP(1000000000000001;-2) -> 1000000000000100
=ROUNDUP(1000000000000001;-3) -> 1000000000001000
=ROUNDUP(1000000000000001;-4) -> 1000000000000000  -- ?

=ROUNDUP(1000000000000005;-4) -> 1000000000010000

=ROUNDUP(100000000000001;-4)  -> 100000000010000
Comment 4 ady 2023-04-14 00:05:29 UTC
(In reply to nobu from comment #3)
> =ROUNDUP(1000000000000001;-4) -> 1000000000000000  -- ?

More than 15 positions. See

https://wiki.documentfoundation.org/Faq/Calc/Accuracy

https://help.libreoffice.org/latest/en-US/text/scalc/01/calculation_accuracy.html
Comment 5 Mike Kaganski 2023-04-14 08:13:59 UTC
I marked this as a dupe for a purpose, because it is a duplicate of bug 154792. You removed yourself from CC list there, but obviously didn't read bug 154792 comment 2, which explains why the small differences are tolerated there (using approxFloor for ROUNDDOWN, and approxCeil for ROUNDUP, respectively).
Comment 6 Mike Kaganski 2023-04-14 08:14:57 UTC
And it's not specific to omitting the second argument - just use 0, or any other value, and you get lots of similar results.
Comment 7 ady 2023-04-15 22:25:25 UTC
(In reply comment #5)
> You removed yourself from CC list there, 

@nobu, there are news for you in bug 154792, among others. You shouldn't have un-cc'ed :).