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

List:       koffice-devel
Subject:    KSpread: Number class - some issues
From:       "Tomas Mecir" <mecirt () gmail ! com>
Date:       2007-05-27 13:34:26
Message-ID: 492258b10705270634s6bc3a971rf9c2ad53b37f103a () mail ! gmail ! com
[Download RAW message or body]

Hi everyone !

Having a bit of a dilemma here, and was hoping that someone would be
able to help out with an advice or something.

I am implementing a Number class for KSpread, which will be used to
store all the numbers, and will be used within the formula engine and
such. The class at the moment is supports integer, floating-point and
complex values. No GnuMP functionality as of yet, but I'm leaving the
door open for that.

The questions are as follows:

- do we want to store integers separately, or would it be acceptable
to simply convert them all to double and be done with it ? Operations
with doubles are somewhat slower, but that'd be compensated by easier
algorithms (no need to distinguish between int+double, double+double,
int+int, and so on)

- do we want to store complex numbers as std::complex or would if be
sufficient to simply store two doubles ? The latter, again, would make
for much simpler algorithms, at the cost of having to create
std::complex instances for more complex functions like sin/... (this
is a non-issue, because those are slow compared to object creation
anyway)

- do we want to use std::complex at all ? I could implement the
complex sin/... functions, which would be a bit of a code duplication,
but the advantage would be that it'd make things easier once I delve
into precision support (GnuMP and all).

My personal preference is to use doubles only, and no std::complex, so
unless someone has a different opinion, this is what I am going to do
( and yes Ariya, I definitely do plan to write tests for the class :-)
).

/ Tomas
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.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