support for long numbers
Nicolas Goutte
nicolasg at snafu.de
Wed Oct 6 00:56:59 BST 2004
>List: kde-core-devel
>Subject: Re: support for long numbers
> From: Diego Iastrubni <elcuco () kdemail ! net>
>Date: 2004-10-04 17:39:54
>Message-ID: <200410041939.54617.elcuco () kdemail ! net>
>
>áéåí ùðé, 4 áàå÷èåáø 2004, 17:03, ðëúá òì éãé Stephan Kulow:
>> Am Monday 04 October 2004 16:31 schrieb Diego Iastrubni:
>> > Does KDE need such beast? If it does, I will try to finish some thigns
>kcalc, canuse this. Note that kspread uses kcalc now to compute numbers (I
>think), so both application can banefit from this.
>
No, KSpread is not related to KCalc, not even KSpread's calculator is KCalc
(even if it is discussed to change that for ages.)
In KSpread, there was the idea to use GMP. However it is not possible
currently and it is not priority goal either. (It is part of bug #52359)
>>The numbers also sypport a "display". The idea is that each number can be
>>displayed on screen in many ways... for example in Roman numerals, Indic,
>>Hewrew... etc.. I have implemented Roman, Armenic, Hebrew, and Indic/Arabic
>>(which means every ther script based on 10 digits is damm easy to implement,
>>just derive as new class).
If you mean non-European digits, there is a start of support in Qt 3.3's
QLocale, which is supposed to be improved in Qt4. (For KSpread, bug #79862.)
>> > (for example rewrite the division code, and implement display->qnumber,
>> > and changing bases for numbers?).
>>
>> I don't think KDE needs such a beast. BTW: why aren't you wrapping
>> http://www.swox.com/gmp/ instead of implementing it on your own?
>>
>> Greetings, Stephan
>Since I did not know such beast existed. I wrote this code as part of an
>assignment in college.
>
>The library has also a c++ wrapper, so no work is needed to usethis inside
>KDE.
>
>I have tested the lib, it's fast. It did 6 millions i++ in 2 secs here (my
>class did it in 1 minute and a half). However, when I tried to test
>multiplications I used a factorial function, and it returned a wrong value.
>
>This lib has no way of representing numbers in different ways (like mine
>does), and does not support munbers in different bases.
GMP has the advantage to have a rather complete mathematical library and also
that somebody external is managing it. (I do not think that we have many
mathematicians for KDE.)
As for bases, at least some functions of GMP can use a different base, like
mpz_set_str and mpz_get_str
(Of course, that is only for integers, but it is only there were bases are
useful.)
Have a nice day!
(...)
More information about the kde-core-devel
mailing list