https://bugs.documentfoundation.org/show_bug.cgi?id=157856

            Bug ID: 157856
           Summary: BASIC macro not recognising sum 0.05+0.90 equals 0.95
           Product: LibreOffice
           Version: 7.6.2.1 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: cppj...@hotmail.com

Description:
It looks like I've found a bug when running a BASIC macro on LibreOffice Calc
(7.6.2.1 x86_64), which doesn't fault when I run it the same macro on Apache
OpenOffice calc (4.1.5 Build 9789 Rev 1817496 2017-12-11 17:25).
Two cells are summed; values 0.05 and 0.9, giving a sum of 0.95.
When LibreOffice runs the macro it returns a false to [0.05 plus 0.9 equaling
0.95], whereas OpenOffice returns true.
All involved cells are formatted as Category > Number and Format > General.
I tried changing “Decimal places:” under Options but that didn't make any
difference.
The workaround solution I found was changing the first cell value from “0.05”
to “=0.95-0.9” (not including the “” ofcourse).
I also tried “=1-0.95” which interestingly did not work.
The following might be a clue to the underlying bug: for the entries that
didn't work (“0.5” and “=1-0.95”), down the bottom right hand side of the
window it says “Sum: 0.05” as you'd expect, but for the entry that made it work
(“=0.95-0.9”) it says “Average: 0.0499999999999999; Sum: 0.0499999999999999”. 

The “Sum:” value for “=0.95-0.9” on OpenOffice calc is 0.05 instead of 
0.0499999999999999.


Steps to Reproduce:
1.Create 3 number cells with the following values: 0.05, 0.9, 0.95.
2.Run a BASIC macro to report if the first two cells equal the third cell.
3.It incorrectly behaves as if the 0.95 cell is not equal to 0.05 + 0.9
(returns false).
(More info in Description.)

Actual Results:
The only way I could get the macro to work was by changing the cell value from
"0.05" to "=0.95-0.9".

Expected Results:
OpenOffice's Calc's BASIC macro's "if" statement to return true regardless of
the first cell being "0.05" or "=0.95-0.9", as it does in OpenOffice calc.

OpenOffice's Calc's "Sum: " value should return "0.05" to "=0.95-0.9", as it
does in OpenOffice calc.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 2; OS: Windows 6.1 Service Pack 1 Build 7601; UI render:
Skia/Raster; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to