Arbitrary precision decimal numbers

Discussion in 'C++' started by =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=, Apr 21, 2005.

  1. 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
     
    =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=, Apr 21, 2005
    #1
    1. Advertising

  2. * =?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?
     
    Alf P. Steinbach, Apr 21, 2005
    #2
    1. Advertising

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

    Basil Guest

    > 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
     
    Basil, Apr 22, 2005
    #3
  4. =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=

    Grant Schoep Guest


    >
    > 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
     
    Grant Schoep, Apr 26, 2005
    #4
  5. =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=

    Basil Guest

    > >
    > > 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
     
    Basil, Apr 26, 2005
    #5
  6. =?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=

    Alex Vinokur Guest

    Alex Vinokur, Apr 26, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thinkit
    Replies:
    8
    Views:
    528
    Thinkit
    Dec 24, 2003
  2. Jack
    Replies:
    2
    Views:
    385
    Alf P. Steinbach
    Dec 10, 2003
  3. Honestmath
    Replies:
    5
    Views:
    563
    Honestmath
    Dec 13, 2004
  4. Replies:
    2
    Views:
    425
    Alf P. Steinbach
    Dec 13, 2004
  5. christopher diggins

    Diggins PDP #3 : arbitrary precision integers

    christopher diggins, May 24, 2005, in forum: C++
    Replies:
    0
    Views:
    382
    christopher diggins
    May 24, 2005
Loading...

Share This Page