gmp

Are there any limits to GMP?

倾然丶 夕夏残阳落幕 提交于 2021-01-27 18:42:27
问题 All the documentation for GMP seems to imply that there are no limits. Is this really true? I want to do some simple integer maths (add, shift, xor, multiply, divide etc) but with truly enormous numbers up to 2^2^96 (that is 2^79,228,162,514,264,337,593,543,950,336 which is likely to be orders of magnitude more memory than you have in your computer) or even 2^2^256. If I go to the trouble of getting GMP and coding against it would it raise its eyebrows at me for asking for such extraordinary

Error when attempting to use a type from GNU's GMP library as the yylval type for Bison

浪尽此生 提交于 2021-01-27 06:37:19
问题 I'm attempting to use the type mpz_t from the GMP library as the type for yylval by including the following in the Bison file: %define api.value.type {mpz_t} I checked the generated parser and it correctly generates the line typedef mpz_t YYSTYPE , with YYSTYPE later being used to create yylval . mpz_t is typdefed as typedef __mpz_struct mpz_t[1]; in the GMP header file gmp.h . In turn, __mpz_struct is typdefed as typedef struct { // struct members here - don't believe they're important } _

Overflow handling in GMP pow

吃可爱长大的小学妹 提交于 2021-01-26 06:53:04
问题 (I am only an indirect user of the GMP-library primarily through swi-prolog and yap. But I am very much interested in fixing this problem.) When performing exponentiations with ridiculously large values, the host-systems or GMP are no longer able to handle the overflows appropriately. I have talked to the developers of above systems, but they do not see an easy fix for this. Is this problem known to other GMP systems/users? How do you handle such overflows? As a sanity check first test the

Overflow handling in GMP pow

醉酒当歌 提交于 2021-01-26 06:52:40
问题 (I am only an indirect user of the GMP-library primarily through swi-prolog and yap. But I am very much interested in fixing this problem.) When performing exponentiations with ridiculously large values, the host-systems or GMP are no longer able to handle the overflows appropriately. I have talked to the developers of above systems, but they do not see an easy fix for this. Is this problem known to other GMP systems/users? How do you handle such overflows? As a sanity check first test the

Overflow handling in GMP pow

ε祈祈猫儿з 提交于 2021-01-26 06:51:42
问题 (I am only an indirect user of the GMP-library primarily through swi-prolog and yap. But I am very much interested in fixing this problem.) When performing exponentiations with ridiculously large values, the host-systems or GMP are no longer able to handle the overflows appropriately. I have talked to the developers of above systems, but they do not see an easy fix for this. Is this problem known to other GMP systems/users? How do you handle such overflows? As a sanity check first test the

How to use gmp-mpir-mpfr in eclipse correctly?

点点圈 提交于 2020-12-15 06:58:50
问题 I've managed to to use mpfr-mpir-gmp in CodeBlocks but I want to in eclipse C++: When I compile the code it compiles and build but if I run the project it says: "error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory". So can anyone show me how to configure eclipse to use gmp-mpifr-mpir correctly? If I compile from a terminal: g++ -lmpir -lmpfr -lgmp myEclpiseMPFRMPIRproj.cpp then : ./a.out It works fine and doesn't complain about the

How to use gmp-mpir-mpfr in eclipse correctly?

家住魔仙堡 提交于 2020-12-15 06:58:30
问题 I've managed to to use mpfr-mpir-gmp in CodeBlocks but I want to in eclipse C++: When I compile the code it compiles and build but if I run the project it says: "error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory". So can anyone show me how to configure eclipse to use gmp-mpifr-mpir correctly? If I compile from a terminal: g++ -lmpir -lmpfr -lgmp myEclpiseMPFRMPIRproj.cpp then : ./a.out It works fine and doesn't complain about the

Adding floats with gmp gives “correct” results, sort of

偶尔善良 提交于 2020-01-16 00:48:06
问题 In the code below I use mpf_add to add the string representation of two floating values. What I don't understand at this point is why 2.2 + 3.2 = 5.39999999999999999999999999999999999999 . I would have thought that gmp was smart enough to give 5.4 . What am I not comprehending about how gmp does floats? (BTW, when I first wrote this I wasn't sure how to insert a decimal point, thus the plus/minus digit stuff at the end) BSTR __stdcall FBIGSUM(BSTR p1, BSTR p2 ) { USES_CONVERSION; F(n1); F(n2)

Lost precision on GMP mpf_add. Where have my digits gone?

雨燕双飞 提交于 2020-01-15 01:52:24
问题 I'm summing two negative floats: char * lhs = "-2234.6016114467412141"; char * rhs = "-4939600281397002.2812"; According to Perl, using bignum and Math::BigFloat, the answer is -4939600281399236.8828114467412141 However, according to GMP, using the code below, the answer is -4939600281399236.88281 Where have I gone wrong? What happened to the remaining "14467412141"? #include "stdafx.h" #include "gmp-static\gmp.h" #include <stdlib.h> /* For _MAX_PATH definition */ #include <stdio.h> #include