Addition mit beliebig grossen Zahlen



  • Hallo alle zusammen!

    Ich habe ein Problem. Ich muss ein C-Programm schreiben, dass 2 beliebig grosse Zahlen addiert. Das mit der Addition ist ja kein Problem. Aber mit den beliebig grossen Zahlen kommen ich nicht klar.

    Würde mich freuen wenn ich etwas Hilfe von irgendeinen bekommen könnte.

    Bis dann

    Pete



  • Hier ein Versuch meinerseits, extrem ineffizient und nur als Programmierübung gedacht, handhabt große Integer, ist nicht dynamisch (Größe wird in bytes durch ein #define angegeben): http://coderz.net/malfunction/misccode/bigint.zip



  • C und C++ Bibliotheken
    http://www.voyager.prima.de/cpp/libs.html

    Available C++ Libraries FAQ
    http://www.trumphurst.com/cpplibs/cpplibs.phtml

    Toolkits zur Bearbeitung numerischer Probleme:

    GNU MP -- Arithmetic without limitations
    http://www.swox.com/gmp/

    GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface.

    GMP is designed to be as fast as possible, both for small operands and for huge operands. The speed is achieved by using fullwords as the basic arithmetic type, by using fast algorithms, with carefully optimized assembly code for the most common inner loops for a lot of CPUs, and by a general emphasis on speed (instead of simplicity or elegance).

    GMP is believed to be faster than any other similar library. The advantage for GMP increases with the operand sizes for certain operations, since GMP in many cases has asymptotically faster algorithms.

    GMP is distributed under the GNU Lesser General Public License. For more information about the GNU project, please see the official GNU web site.

    HFLOAT -- The HUGE-FLOAT package
    http://www.jjj.de/hfloat/

    hfloat (for huge floats) is a library package for doing calculations with floating point numbers of extreme precision. It is optimised for computations with 1000...several million digits. The computations can be done in (almost) arbitrary radix.

    HFLOAT is distributed under the GNU General Public License. For more information about the GNU project, please see the official GNU web site.

    Blitz++
    http://www.oonumerics.org/blitz/

    Template Library für Matrizen und Vektoren. Schnell. Hohe Anforderungen an den Compiler.

    Blitz++ is currently distributed under two licenses. You may choose between either (1) the GNU General Public License, or (2) the Blitz++ Artistic License.


Anmelden zum Antworten