Description: When using the ROUND feature of a table formula in writer, the number of digits to round to, exceeds the number of decimal places in the number provided, LO Writer rounds the number up or down in the last digit anyway. MS Word does not apply rounding in this case. Steps to Reproduce: 1. Create a table 2. Insert formula (4.545 ROUND 5) Actual Results: Result is 4.55 Expected Results: MS Word returns 4.545 Reproducible: Always User Profile Reset: No Additional Info: Version: 6.0.7.3 Build ID: 1:6.0.7-0ubuntu0.18.04.2 CPU threads: 12; OS: Linux 4.15; UI render: default; VCL: gtk3; Locale: en-US (en_US.UTF-8); Calc: group
Created attachment 162941 [details] Example document
I haven't understood the algorithm yet(just for lazyness). https://opengrok.libreoffice.org/xref/core/sw/source/core/bastyp/calc.cxx?r=474a9171#920
Reproduced probably the cause is not the calculation, but the format Table uses.
you can find "Number Format" toolbar-item, not "Number Format(Decimal), if you enable Table toolbar displayed around a status bar. Clicking this toolbar-item shows a dialog to specify Numberformat
(In reply to himajin100000 from comment #4) > you can find "Number Format" toolbar-item, not "Number Format(Decimal), if > you enable Table toolbar displayed around a status bar. Clicking this > toolbar-item shows a dialog to specify Numberformat I definitely did test this; specifying number format means I could potentially get 4.545 instead of 4.55. The default hasn't been fixed whatsoever in later updates. Version: 7.1.0.0.alpha0+ Build ID: 52820b52b3bca45e2db527d1cc5f4488b2e0b9d0 CPU threads: 8; OS: Mac OS X 10.15.6; UI render: default; VCL: osx Locale: en-US (en_US.UTF-8); UI: en-US Calc: threaded
This is not a bug. As mentioned in comment 3, the visible result in not related to rounding, but to formatting - which are different concepts. Cell D4 in the table has a "Insert Formula" field with the formula "(4.545 ROUND 5)". Its result is indeed 4.545. Then the field also has *format* - which is "Standard". That format shows up to two decimal digits for a number. So the *displayed result* is rightfully 4.55. But the number contained in the cell is still the correct one - 4.545. You can check that using a new row in the table, and putting this formula (not a field!) to D6: "=<D4>+1". Then if you use Table->Number Format to increase decimal places, you would see that the result is 5.545, which proves that D4 has the correct numeric value. Then you could change the field's formula in D4 to "(4.545 ROUND 2)", and see that D6 now shows 5.55 (although D4 is visually unchanged). That is because the ROUND changes the value, while formatting only changes display - that a very important thing about formatting. And then you may change the format used in the D4's field, clicking on "Additional formats..." element in the "Format" list of the field editor dialog. Put there any number into the decimal places box. Closing NOTABUG.