suche Bibliothek für Sehr Große Integer Zahlen (am besten mit anleitung)



  • @x_dawnbeach
    Dann hast du bei GMP nicht richtig nachgeschaut.
    Zitat von 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 practical 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.



  • arbeitet lint auch genau oder rundet es zahlen nach einer bestimmten anzahl von stellen?



  • probier's aus...



  • wie kann ich die lint werte in einer console wieder ausgeben?die standartproceduren können das nicht, da diese lint nicht kennen. Weis jemand eine antwort?



  • Du kannst mittels

    lint z = 1234;
    std::cout<<z.value();
    

    ausgeben, hier zur Basis zehn.

    Gibst du value ein Argument (von 2-36) mit, wird nach dieser Basis ausgegeben.

    MfG

    GPC



  • wie kann ich nun noch aus einem lint wert die wurzel ziehen?dann wäre mein problem gelöst.



  • warum kann man denn diesen code nicht compilieren??

    #include <iostream>
    #include <lint.h>
    
    using namespace std;
    
    int main()
    {
    	lint n1=5643;
    	cout<<n1.value();
    
    	return 0;
    }
    

    fehlermeldungen:

    --------------------Konfiguration: lint - Win32 Debug--------------------
    Kompilierung läuft...
    lint.cpp
    Linker-Vorgang läuft...
    lint.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall lint::~lint(void)" (??1lint@@QAE@XZ)
    lint.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall lint::lint(long)" (??0lint@@QAE@J@Z)
    Debug/lint.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise
    Fehler beim Ausführen von link.exe.
    
    lint.exe - 3 Fehler, 0 Warnung(en)
    

    die meldungen sagen mir ehrlich gesagt garnichts und ich kann beim besten willen keinen fehler im code erkennen, oder muss man lint doch anders benutzen?
    muss man bei cin was beachten oder kann man einfach

    lint n;
    cin>>n;
    

    schreiben?

    thx so far, Mr. Pink



  • nim einfach fprint(lint_zahl) aus der stdio.h bibliothek.
    aber wie zieh ich nun eine wurzel aus einem lint wert?



  • @Mr. Pink
    Du hast scheinbar die lint.o (aus der lint.cpp) nicht mitgelinkt.

    @x_dawnbeach
    Diese Funktion ist da nicht dabei. Du müsstest sie selber implementieren. Dieses Verfahren wäre möglich
    http://de.wikipedia.org/wiki/Babylonisches_Wurzelziehen
    evtl. kann man auch auf die Wurzel verzichten. Wenn das Ergebnis der Wurzel nur verglichen werden soll ist das einfach (Quadrieren).
    Das Ergebnis muss aber in ein double oder so passen.

    [edit]Antwort an x_dawnbeach hinzugefügt.[edit]



  • Du hast scheinbar die lint.o (aus der lint.cpp) nicht mitgelinkt.

    aha, und wie geht das? 🤡
    arbeite erst seit ganz kurzer zeit mit c++ und habe deshalb kaum ahnung, fand das thema aber mal ganz interessant.... 😮
    wie linke ich das denn mit??? habe visual c++ (falls das wichtig ist)
    danke 😕



  • Bei Visual C++ fügst du einfach die lint.cpp zu deinem Projekt hinzu und es müsste gehen.



  • nee, geht nicht, hab die hinzugefügt, aber:

    --------------------Konfiguration: big numbers - Win32 Debug--------------------
    Kompilierung läuft...
    bn.cpp
    lint.cpp
    c:\lint.cpp(449) : error C2361: Initialisierung von 'i' durch 'default'-Marke übersprungen
            c:\lint.cpp(438) : Siehe Deklaration von 'i'
    Fehler beim Ausführen von cl.exe.
    
    big numbers.exe - 1 Fehler, 0 Warnung(en)
    

    ist also nen fehler in der lint.cpp, an der ich aber nix geändert habe.

    so kann nicht mal diese programm kompiliert werden:

    #include <iostream>
    #include <lint.h>
    
    using namespace std;
    
    int main()
    {
    	return 0;
    }
    

    wie haben es denn die gemacht, bei denen es anscheinend problemlos geht???



  • ich habe zum bsp den befehl fprint("dieser text soll ausgegeben werden"); benutzt. du musst oben aber #define "stdio.h" hinzufügen (nach den anderen #define's). dan ging alles bei mir.



  • ich habe nun flgende fehlermelungen im lint.h gefunden:

    f:\prime\prime\lint.cpp(58) : warning C4793: '__asm' : causes native code generation for function 'lint::lint(long *,unsigned int)'
    f:\prime\prime\lint.h(45) : see declaration of 'lint::lint'
    f:\prime\prime\lint.cpp(82) : warning C4793: '__asm' : causes native code generation for function 'void lint::copy_from(lint &)'
    f:\prime\prime\lint.h(35) : see declaration of 'lint::copy_from'
    f:\prime\prime\lint.cpp(134) : warning C4793: '__asm' : causes native code generation for function 'void lint::not(void)'
    f:\prime\prime\lint.h(38) : see declaration of 'lint::not'
    f:\prime\prime\lint.cpp(163) : warning C4793: '__asm' : causes native code generation for function 'lint &lint::operator =(long)'
    f:\prime\prime\lint.h(49) : see declaration of 'lint::operator ='
    f:\prime\prime\lint.cpp(191) : warning C4793: '__asm' : causes native code generation for function 'lint &lint::operator ++(void)'
    f:\prime\prime\lint.h(52) : see declaration of 'lint::operator ++'
    f:\prime\prime\lint.cpp(223) : warning C4793: '__asm' : causes native code generation for function 'lint &lint::operator --(void)'
    f:\prime\prime\lint.h(54) : see declaration of 'lint::operator --'
    f:\prime\prime\lint.cpp(442) : warning C4996: '_itoa' was declared deprecated
    C:\Programme\Microsoft Visual Studio 8\VC\include\stdlib.h(491) : see declaration of '_itoa'
    Message: 'This function or variable may be unsafe. Consider using _itoa_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    f:\prime\prime\lint.cpp(443) : warning C4996: 'strcat' was declared deprecated
    C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(78) : see declaration of 'strcat'
    Message: 'This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    f:\prime\prime\lint.cpp(474) : warning C4996: 'strrev' was declared deprecated
    C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(217) : see declaration of 'strrev'
    Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strrev. See online help for details.'
    f:\prime\prime\lint.cpp(477) : warning C4996: 'strncpy' was declared deprecated
    C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(156) : see declaration of 'strncpy'
    Message: 'This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    f:\prime\prime\lint.cpp(495) : warning C4793: '__asm' : causes native code generation for function 'lint &operator +(lint &,long)'
    f:\prime\prime\lint.h(85) : see declaration of 'operator +'
    f:\prime\prime\lint.cpp(490) : error C2711: 'operator +' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(495) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(513) : error C3821: 'lint &operator +(lint &,long)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(526) : warning C4793: '__asm' : causes native code generation for function 'lint &operator +(lint &,lint &)'
    f:\prime\prime\lint.h(87) : see declaration of 'operator +'
    f:\prime\prime\lint.cpp(521) : error C2711: 'operator +' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(526) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(542) : error C3821: 'lint &operator +(lint &,lint &)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(549) : warning C4793: '__asm' : causes native code generation for function 'lint &operator -(lint &,long)'
    f:\prime\prime\lint.h(89) : see declaration of 'operator -'
    f:\prime\prime\lint.cpp(545) : error C2711: 'operator -' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(549) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(564) : error C3821: 'lint &operator -(lint &,long)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(579) : warning C4793: '__asm' : causes native code generation for function 'lint &operator -(lint &,lint &)'
    f:\prime\prime\lint.h(91) : see declaration of 'operator -'
    f:\prime\prime\lint.cpp(574) : error C2711: 'operator -' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(579) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(595) : error C3821: 'lint &operator -(lint &,lint &)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(610) : warning C4793: '__asm' : causes native code generation for function 'lint &operator <<(lint &,long)'
    f:\prime\prime\lint.h(93) : see declaration of 'operator <<'
    f:\prime\prime\lint.cpp(599) : error C2711: 'operator <<' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(610) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(649) : error C3821: 'lint &operator <<(lint &,long)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(682) : warning C4793: '__asm' : causes native code generation for function 'lint &operator >>(lint &,long)'
    f:\prime\prime\lint.h(96) : see declaration of 'operator >>'
    f:\prime\prime\lint.cpp(671) : error C2711: 'operator >>' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(682) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(726) : error C3821: 'lint &operator >>(lint &,long)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(756) : warning C4793: '__asm' : causes native code generation for function 'lint &operator *(lint &,long)'
    f:\prime\prime\lint.h(99) : see declaration of 'operator *'
    f:\prime\prime\lint.cpp(749) : error C2711: 'operator *' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(756) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(773) : error C3821: 'lint &operator *(lint &,long)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(841) : warning C4793: '__asm' : causes native code generation for function 'void div_mod_calculate(lint &,lint &,lint &,lint &)'
    f:\prime\prime\lint.h(37) : see declaration of 'div_mod_calculate'
    f:\prime\prime\lint.cpp(805) : error C2711: 'div_mod_calculate' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(841) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(923) : error C3821: 'void div_mod_calculate(lint &,lint &,lint &,lint &)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(968) : warning C4793: '__asm' : causes native code generation for function 'bool operator <(lint &,lint &)'
    f:\prime\prime\lint.h(118) : see declaration of 'operator <'
    f:\prime\prime\lint.cpp(1017) : warning C4793: '__asm' : causes native code generation for function 'bool operator <=(lint &,lint &)'
    f:\prime\prime\lint.h(122) : see declaration of 'operator <='
    f:\prime\prime\lint.cpp(1068) : warning C4793: '__asm' : causes native code generation for function 'bool operator >(lint &,lint &)'
    f:\prime\prime\lint.h(126) : see declaration of 'operator >'
    f:\prime\prime\lint.cpp(1114) : warning C4793: '__asm' : causes native code generation for function 'bool operator >=(lint &,lint &)'
    f:\prime\prime\lint.h(130) : see declaration of 'operator >='
    f:\prime\prime\lint.cpp(1164) : warning C4793: '__asm' : causes native code generation for function 'bool operator ==(lint &,lint &)'
    f:\prime\prime\lint.h(112) : see declaration of 'operator =='
    f:\prime\prime\lint.cpp(1230) : warning C4793: '__asm' : causes native code generation for function 'lint &operator &(lint &,lint &)'
    f:\prime\prime\lint.h(136) : see declaration of 'operator &'
    f:\prime\prime\lint.cpp(1223) : error C2711: 'operator &' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(1230) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(1243) : error C3821: 'lint &operator &(lint &,lint &)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(1270) : warning C4793: '__asm' : causes native code generation for function 'lint &operator |(lint &,lint &)'
    f:\prime\prime\lint.h(140) : see declaration of 'operator |'
    f:\prime\prime\lint.cpp(1263) : error C2711: 'operator |' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(1270) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(1283) : error C3821: 'lint &operator |(lint &,lint &)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged
    f:\prime\prime\lint.cpp(1310) : warning C4793: '__asm' : causes native code generation for function 'lint &operator ^(lint &,lint &)'
    f:\prime\prime\lint.h(144) : see declaration of 'operator ^'
    f:\prime\prime\lint.cpp(1303) : error C2711: 'operator ^' : this functon cannot be compiled as managed, consider using #pragma unmanaged
    The function uses inline assembler or an unsupported intrinsic function
    f:\prime\prime\lint.cpp(1310) : see source of the previous compiler diagnostic
    f:\prime\prime\lint.cpp(1323) : error C3821: 'lint &operator ^(lint &,lint &)': managed type or function cannot be used in an unmanaged function
    presence of '__asm' or '_setjmp' makes a function unmanaged

    wie kann ich diese lösen?



  • @Mr. Pink
    Liegt der Header im aktuellen Verzeichnis? Wenn ja, dann nicht #include <lint.h> sondern #include "lint.h"

    x_dawnbeach schrieb:

    nim einfach fprint(lint_zahl) aus der stdio.h bibliothek.

    Nein, denn erstens heißt es printf (bzw. fprintf) und zweitens ist das C, wir programmieren sauberes C++. Und dazu gehören eben die Stream-Klassen, also cout und cin.

    MfG

    GPC



  • zusammenfassend kann ich nun sagen das keine der genannten varianten funktioniert. kennt nun also jemand eine bibliothek oder eine methode einen beliebig großen int typ zu definieren (mit div, mod, pow2, ++, --,...)?und ich möchte die jenigen bitten, die eine löung haben, auch zu zeigen, wie diese angewandt werden soll. Danke für alle bisherigen bemühungen, wäre schön wenn jemand noch eine lösung hat,
    euer
    x_dawnbeach.



  • hmja, bei mir kommt auch der selbe fehler wenn ich die dateien ins projektverzeichnis kopiere, liegt also nicht daran...
    trotzdem danke für die mühen



  • x_dawnbeach schrieb:

    zusammenfassend kann ich nun sagen das keine der genannten varianten funktioniert. kennt nun also jemand eine bibliothek oder eine methode einen beliebig großen int typ zu definieren (mit div, mod, pow2, ++, --,...)?

    doch gmp sollte das alles liefern.. einfach mal googlen..



  • Allerdings ist die GMP unter Windows nicht ganz trivial zu bauen. Brauchst halt erst cygwin oder mingw. Es ist zwar unter swox.com/gmp dokumentiert, aber wenn man UNIX, und speziell GNU nicht kennt, dürfte man damit ein bisschen zu kämpfen haben.



  • kann den hier keiner mal ne kurze und verständliche anleitung geben wie ich gmp in visual c++ studio 2005 express implementiere?


Anmelden zum Antworten