Issue 80122 - Miscalculations in floating point operations
Summary: Miscalculations in floating point operations
Status: CLOSED DUPLICATE of issue 18154
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: OOo 2.2.1
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: ooo
QA Contact: issues@sc
URL: http://tikker.org/Miscalculation_Test...
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-27 17:08 UTC by oo_tikker
Modified: 2007-07-31 16:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Examples for good and bad calculations (7.95 KB, application/vnd.sun.xml.calc)
2007-07-27 17:09 UTC, oo_tikker
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description oo_tikker 2007-07-27 17:08:03 UTC
I have spotted a strange issue that occurs when I try to subtract three float
figures like:

0,71 - 0,7 - 0,01

The result should be 0, but isn't.

Maxing out the number of digits, I get the following:

0,71000000000000000000 -
0,70000000000000000000 -
0,01000000000000000000 =
-0,00000000000000010235

It appears to be the same with several other figures, too, yet not with all. I
have put together a few examples in the file available through the URL. 

My guess would be a problem with periodic binary representations of certain
values in combination with the internal rounding algorithm. Maybe you can spot it?

Thanks for the great project, and keep up the good work!

Thomas
Comment 1 oo_tikker 2007-07-27 17:09:08 UTC
Created attachment 47153 [details]
Examples for good and bad calculations
Comment 2 frank 2007-07-27 19:53:55 UTC
Hi Eike,

a double to Issue 18154 ?

If so please close as double.

Frank
Comment 3 oo_tikker 2007-07-28 00:08:49 UTC
The problem is not necessarily that I need more than 12 digits precision, but
that the test for a-b-c == 0 is completely useless in these cases, which takes
away a lot of reliability of the tool. So it's rather more than a nice to have.

best,
Thomas
Comment 4 ooo 2007-07-31 16:38:11 UTC
dup

*** This issue has been marked as a duplicate of 18154 ***
Comment 5 ooo 2007-07-31 16:38:32 UTC
Closing.