Arbitrary precision decimal numbers

  • Thread starter =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=
  • Start date
?

=?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=

Hello!

I am trying to find a minimal class/lib that handles arbitrary precision
decimal numbers. I would be happy if this class supported as little as
addition, subtraction, multiplication, division and comparisons. For
some reason it's quite hard to find such a class on the net. Maybe
because it is trivial to implement such a class?

The only library I have found so far is MAPM
(http://www.tc.umn.edu/~ringx004/mapm-main.html). This library seems
quite small and competent. I would, however, prefer something even
smaller. =)

Maybe someone on this list has some information to share with me about a
minimal arbitrary precision implementaion.

:.:: mattias
 
A

Alf P. Steinbach

* =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=:
Hello!

I am trying to find a minimal class/lib that handles arbitrary precision
decimal numbers. I would be happy if this class supported as little as
addition, subtraction, multiplication, division and comparisons. For
some reason it's quite hard to find such a class on the net. Maybe
because it is trivial to implement such a class?

The only library I have found so far is MAPM
(http://www.tc.umn.edu/~ringx004/mapm-main.html). This library seems
quite small and competent. I would, however, prefer something even
smaller. =)

Maybe someone on this list has some information to share with me about a
minimal arbitrary precision implementaion.

<url: http://www.swox.com/gmp/>
 
B

Basil

I am trying to find a minimal class/lib that handles arbitrary precision
decimal numbers. I would be happy if this class supported as little as
addition, subtraction, multiplication, division and comparisons. For
some reason it's quite hard to find such a class on the net. Maybe
because it is trivial to implement such a class?

The only library I have found so far is MAPM
(http://www.tc.umn.edu/~ringx004/mapm-main.html). This library seems
quite small and competent. I would, however, prefer something even
smaller. =)

Maybe someone on this list has some information to share with me about a
minimal arbitrary precision implementaion.

:.:: mattias

Hello.

You can use some library for long number. For example:

http://sourceforge.net/projects/muntl/

Multiprecision unsigned number template library (MUNTL). The program
is intended for the organization of calculations with the big
precision for unsigned numbers. Program is very fast because do not
use any heap call (new, malloc etc.) All buffers is static allocated.
Program is not use GMP. Program is not limit of number length. For use
this library need only one small header file di.h (26Kb). Adapt for
GCC 3.2.2 and BCB60.

Sincerely yours
Basil
 
G

Grant Schoep

Multiprecision unsigned number template library (MUNTL). The program
is intended for the organization of calculations with the big
precision for unsigned numbers. Program is very fast because do not
use any heap call (new, malloc etc.) All buffers is static allocated.
Program is not use GMP. Program is not limit of number length. For use
this library need only one small header file di.h (26Kb). Adapt for
GCC 3.2.2 and BCB60.

Sincerely yours
Basil

Basil,
Question, I'm actually interested in MUNTL and or GMP.

MUNTL
http://sourceforge.net/projects/muntl/

GMP
http://www.swox.com/gmp/


You seem to recommend not to use GMP, Any particular reasons? In my case, I
have loads of CPU and memory horsepower, but I need to do it very fast.
I'll probably muck around with both, but wondering what you meant by
recommending to NOT use GMP.

Cheers
-grant
 
B

Basil

Basil,
Question, I'm actually interested in MUNTL and or GMP.

MUNTL
http://sourceforge.net/projects/muntl/

GMP
http://www.swox.com/gmp/


You seem to recommend not to use GMP, Any particular reasons? In my case, I
have loads of CPU and memory horsepower, but I need to do it very fast.
I'll probably muck around with both, but wondering what you meant by
recommending to NOT use GMP.

Cheers
-grant
Hello
etc.) >>All buffers is static allocated.


GMP keeps all of the buffer in a heap.

For many platforms heap system call is carried out slowly
in comparison with access to static objects
or to objects in a stack. Therefore if your program constantly
works with the big numbers and uses GMP, a lot of time
will be spent for allocation and removal of memory in a heap.

If your program works with the big numbers once at start
and once at end, the difference will be imperceptible.:)

Sincerely yours
Basil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top