GNOME Bugzilla – Bug 541500
Numbers with >15 digits inaccurately displayed
Last modified: 2008-07-09 15:44:13 UTC
Please describe the problem: 29513736 * 92842033 = 2740115251665280 (according to Gnumeric) Correct answer = 2740115251665288 Steps to reproduce: 1. A1 = 29513736 2. A2 = 92842033 3. A3 = A1*A2 Actual results: Wrong answer given (2740115251665280) Expected results: The right answer (2740115251665288) Does this happen every time? Yes Other information: Gnome Calc, oocalc, bc, etc. all produce the correct answer.
We were outsmarting ourselves in the 1.6 series. 1.8.x is fine.
For the benefit on anyone from comp.os.linux.advocacy who might wander by, this bug was actually in goffice and was fixed, if not before, in goffice 0.3.7: * Total rewrite of number formatting. We went from interpreting the format strings to pre-compiling them into byte-code. That, in turn, made it possible to do the actual number-to- string operation using (a variant of) C's sprintf. If memory serves me right, the problem would affect only numbers with 15 or more digits. Note, that not all 15-digits integers can be represented accurately in the standard C "double" type. For example, 999999999999999 cannot. If you need to operate with integers of this scale accurately, you need to compile with "long double" support. That should get you up to 33 digits, depending on hardware platform.