Bug 137585

Summary: pi calculation gives errors on its value and pastes extra places
Product: [Applications] kcalc Reporter: david powell <achiestdragon>
Component: generalAssignee: Klaus Niederkrüger <kniederk>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description david powell 2006-11-19 18:33:00 UTC
Version:           2.0.1 (using KDE 3.5.1 Level "a" , SUSE 10.1)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.16.13-4-default

the constant pi given by kcalc is 
3.1415926535897931159979634685441851616  (set to 31 digits)
unfortunatly this is wrong 
according to http://www.joyofpi.com/pi.html
the constant should give
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165
to a few more decimal places 

it is correct to 
3.141592653589793

what i found was if set to 12 decimal places it displays the above  but copying the result and pasteing it adds an extra 3 decimal places to the pasted result 
so 
3.141592653589793 on the kcalc display would give
3.141592653589793116 in the pasted results 
(another bug also i guess sorry dont have time to post 2 reports for it )
Comment 1 Nick Warne 2006-11-20 19:28:29 UTC
Interesting.  In knumber/knumber.cpp

KNumber const KNumber::Pi("3.141592653589793238462643383279502884197169"
                          "39937510582097494459230781640628620899862803"
                          "4825342117068");

Is defined OK (apart from the last digit rounded up.

Strange bug?

Nick
Comment 2 Nick Warne 2006-11-20 19:37:01 UTC
Actually, Euler's number (e) goes wrong as well:

Kcalc:
2.7182818284590450907955982984276488423
2.718281828459045235360287471352662497757247093699959574966...
e:

knumber/knumber.cpp

KNumber const KNumber::Euler("2.718281828459045235360287471352662497757"
                             "24709369995957496696762772407663035354759"
                             "4571382178525166427");

Comment 3 Klaus Niederkrüger 2007-01-05 02:17:09 UTC
The bug seems to be fixed in the svn-code for KDE-3.5.6.

Thanks for the report.

Klaus