Bug 131246 - Surprizing result from ROUND()
Summary: Surprizing result from ROUND()
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-09 19:55 UTC by Stasinos Konstantopoulos
Modified: 2020-03-10 08:13 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
File that demonstrates the error (8.67 KB, application/octet-stream)
2020-03-09 19:57 UTC, Stasinos Konstantopoulos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stasinos Konstantopoulos 2020-03-09 19:55:40 UTC
Description:
For a particular cell, ROUND(5.5) gives 5 instead of 6. I tried seeing more decimal digits in case the number is a 5,499999999, but it is a clear 5.5.

If I perform the same calculation in a different cell, the result is as expected.

The file was originally created on MS Excel, and then edited and saved in LibreOffice as an xlsx. If saved as an ods, the error disappears. 

Steps to Reproduce:
Open the attahed file.
See sheet3

Actual Results:
ROUND(5.5) gives 5

Expected Results:
ROUND(5.5) should give 6.
It does give 6, except for that particular cell.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 6.1.5.2
Build ID: 1:6.1.5-3+deb10u3
CPU threads: 6; OS: Linux 4.19; UI render: default; VCL: gtk3_kde5; 
Locale: en-US (en_US.UTF-8); Calc: group threaded
Comment 1 Stasinos Konstantopoulos 2020-03-09 19:57:24 UTC
Created attachment 158525 [details]
File that demonstrates the error
Comment 2 Xavier Van Wijmeersch 2020-03-10 07:50:06 UTC
I removed the zero in Round(c11,0) and i have the correct result
I think you don't need the count argument in round() if you only want a result without decimal numbers
I never use the count argument in the round function

ROUND

Rounds a number to a certain number of decimal places.
Syntax

ROUND(Number; Count)

Returns Number rounded to Count decimal places. If Count is omitted or zero, the function rounds to the nearest integer. If Count is negative, the function rounds to the nearest 10, 100, 1000, etc.

This function rounds to the nearest number. See ROUNDDOWN and ROUNDUP for alternatives.
Example

=ROUND(2.348;2) returns 2.35

=ROUND(-32.4834;3) returns -32.483. Change the cell format to see all decimals.

=ROUND(2.348;0) returns 2.

=ROUND(2.5) returns 3.

=ROUND(987.65;-2) returns 1000.
Comment 3 Xavier Van Wijmeersch 2020-03-10 08:01:47 UTC
Did another test changing the , to ; in round(c11,0) give me also a correct result off 6
Tested in other spreadsheets the same correct value off 6

So for me its a WFM
Comment 4 m_a_riosv 2020-03-10 08:13:07 UTC
A hard recalc Menu/Data/Calculate/Recalculate hard, seems to solve the issue.

It is a xlsx file, with this file type have been reported similar issues, for that it's the option to force recalculate on open, Menu/Tools/Options/LibreOffice calc/Formula/Recalculation on file load

Wrong value is in the file <f aca="false">ROUND(C11,0)</f><v>5</v>