[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: ROUNDUP in kspread
From:       Hasso Tepper <hasso () estpak ! ee>
Date:       2001-08-01 22:16:10
[Download RAW message or body]

Just saw Daniel's fix to the kspread testcase. ROUNDUP(2,99;5)=2,99001?
Really? I don't think so. It should be still 2,99.

Also, seems that problem is more general than just roundup and ceil 
functions. When you multiply or divide floating point numbers you will 
not get exact results. 

printf("%0.20lf\n",(0.07*100.0)) returns 7.00000000000000088818
printf("%0.20lf\n",(0.1/2)) returns 0.05000000000000000278

Every rounding function is affected (and maybe others as well). And don't
look at staroffice and gnumeric. They have same problems :). Openoffice
in the other way seems to behave correctly. And luckily it has source 
available as well. Files to look at (633 build sources):

tools/source/generic/solmath.cxx (SolarMath::Round class)
tools/inc/solmath.hxx (SolarMath::Approx* classes)

I really wish I could explain better and even provide patches but I'm 
starting to feel that it is just beyond my knowledge. Maybe in future :).

regards,

Hasso

PS. Just noticed that functions are case sensitive in kspread. Should it 
be this way? In staroffice user can enter in lower case as well but it
will be conerted upper case. Also, in kspread some functions are lower
case, some upper case. It just annoys user, I think.
_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic