Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Arbitrary precision decimal numbers

Reply
Thread Tools

Arbitrary precision decimal numbers

 
 
=?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=
Guest
Posts: n/a
 
      04-21-2005
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
 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      04-21-2005
* =?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/>

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
 
Reply With Quote
 
 
 
 
Basil
Guest
Posts: n/a
 
      04-22-2005
> 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
 
Reply With Quote
 
Grant Schoep
Guest
Posts: n/a
 
      04-26-2005

>
> 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
 
Reply With Quote
 
Basil
Guest
Posts: n/a
 
      04-26-2005
> >
> > 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


Hello

>>Program is very fast because do not use any heap call (new, malloc

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
 
Reply With Quote
 
Alex Vinokur
Guest
Posts: n/a
 
      04-26-2005

"Mattias Brändström" <"thebrasse at brasse dot org"> wrote in message news:426764ff$0$175$(E-Mail Removed)...
> Hello!
>
> I am trying to find a minimal class/lib that handles arbitrary precision
> decimal numbers.

[snip]

Look at C++ BigInt class
https://sourceforge.net/projects/cpp-bigint/
http://groups-beta.google.com/group/...6e8d3ae812abbb

--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Diggins PDP #3 : arbitrary precision integers christopher diggins C++ 0 05-24-2005 05:23 AM
calling an arbitrary function w/ arbitrary arguments Honestmath C++ 5 12-13-2004 06:18 AM
PLEASE HELP - Linkage problem in gcc 3.2.3 with arbitrary precision arithmetic cpptutor2000@yahoo.com C++ 2 12-13-2004 05:04 AM
Arbitrary precision binary float class Thinkit Java 8 12-24-2003 12:26 AM
GNU GMP arbitrary precision limitations + question Jack C++ 2 12-10-2003 06:00 AM



Advertisments