Common computer-jargon term to refer to arbitrary-precision math and data-types. The term "arbitrary-precision" refers to the ability of a machine to perform numerical computations whose precision is limited only by the available memory.
Questions tagged [bignum]
362 questions
0
votes
0 answers
openssl hex2bn and bn2hex will not original string, but always a long postfix
Playing with openssl BN_hex2bn and BN_bn2hex. Expecting to get the original string after hex2bn and then bn2hex, but always got a longer string, with the first past the same as the original string, but a long post fix. Followin gis the…

user1470393
- 317
- 4
- 12
0
votes
0 answers
Kattis Bignum division by powers of 10
I'm trying to implement bignum division by powers of 10. Specifically, this is a kattis problem: https://open.kattis.com/problems/divideby100
I believe my answer is correct but I get a time limit exceeded warning. I know it's due to the insert…

user2953932
- 45
- 6
0
votes
2 answers
Why a bignumber is shown incomplete in ECLiPSe Prolog?
I use the latest version of ECLiPSe Prolog 64-bit for Windows, then I compile the code:
:- op(200, yf, !).
!(N, F) :- fac(N, 1, F).
fac(0, F0, F) :- !, F=F0.
fac(N, F0, F) :- N1 is N-1, F1 is F0*N, fac(N1, F1, F).
Query entered:
?- X is 100000 !.
X…

T. S. Larsen
- 1
- 1
0
votes
2 answers
OpenSSL BN_exp() Usage
I have a small program that uses BIGNUM functions BN_exp() and BN_mod_exp() on 64-byte big integers (that are generated via BN_generate_prime_ex()).
Every time I compile and run, the program pauses forever while computing the first call to BN_exp().…

jmu_nova
- 51
- 2
- 10
0
votes
0 answers
Change the decimal places of an existing number in bignumber.js?
If I've got a BigNumber (http://mikemcl.github.io/bignumber.js/) with a particular DECIMAL_PLACES:
let BN = BigNumber.another({ DECIMAL_PLACES: 0 })
a = new BN(10)
How can I change the number of decimal places used for a particular operation?
For…

David Wolever
- 148,955
- 89
- 346
- 502
0
votes
0 answers
Send fixed array vs dynamic array over socket
I am trying to send a BIGNUM (from openssl/bn.h) over socket, but its behaviour is strange.
I use BN_bn2bin() to convert BIGNUM to array of unsigned char and send it over socket using send(). But what the client receives is corrupted. Why?
Here's a…

xtt
- 857
- 1
- 8
- 24
0
votes
0 answers
Using big numbers in C with GMP
i'm havin trouble with a code that is returning a nunber that is bigger than that C can handle. I installed the GMP library but with all the tutorials that i found on the internet i can't seem to make it work. Here is the code with the GMP library's…

Hamilton D
- 11
- 3
0
votes
2 answers
How can I Implement the library GMP.mpz to generate big numbers in Pike?
When I enter the command:
pow(9,999999);
I obtain the following:
Bad argument 1 to pow(). Exponent too large.
Unknown program: pow(Gmp.mpz(999999))
-:1: 9->pow(@0=Gmp.mpz(999999))
HilfeInput:1: HilfeInput()->___HilfeWrapper()
Somebody would be…

WerthJK
- 1
- 1
0
votes
3 answers
Big numbers in C
I'm implementing RSA in C.
I'm using "unsigned long long int" (Top limit: 18446744073709551615).
The problems come when I have to calculate thing like 4294967296 ^ 2.
It should be 18446744073709551616, but I get 0 (overflow).
I mean, I need to…

Alan
- 1
- 1
- 2
0
votes
0 answers
rust, bignums and windows
I've got rust 1.18.0 on windows 10 and I'd like to write something that uses bignums. The rug library looks like a good choice, but a cargo build on a project using it fails because building gmp calls ln -s somewhere down the line.
Is there a rust…
user1569030
0
votes
1 answer
script with big numbers take days
i am trying to run this script and its already run for 2 days. and still dont get answer. i tried long instead int.
what am i supposed to do?
what is the better way to work with big numbers like this? …

DR.P
- 43
- 1
- 7
0
votes
2 answers
pow() function gives wrong result
I want to execute this math function:
3^(3^1000000000) mod 1000000007
the result of this is: 930782551
But do it directly in python takes a huge amount of time, and the program hangs:
return pow(3,pow(3,1000000000),1000000007)
So I thought that…

Don't call me
- 31
- 2
0
votes
1 answer
Function to RoundUP as Microsoft Excel does, in Javascript
Days ago, I started a project in which i needed to do some measure calculation; specifically: statistic calculation. Well, thats not the problem, the problem came with rounding floating numbers (numbers with decimals), and the way javascript deals…

crsuarezf
- 1,201
- 3
- 18
- 33
0
votes
2 answers
Bignum library, slow prime generator
I am developing a bignum library: http://pastebin.com/nFgF3zjW
I implemented the Miller-Rabin algorithm (isprime()), but it is extremely slow, compared to for example OpenSSL's BN_is_prime_fasttest.
I tried profiling and the functions that are…

Ledio Berdellima
- 393
- 1
- 5
- 10
0
votes
1 answer
How to convert an IBAN to an Integer?
Note, this is not about using libraries or any specific programming language. I just want to understand the following concept, from Wikipedia, Validating the IBAN:
Example (fictitious United Kingdom bank, sort code 12-34-56, account number…

q9f
- 11,293
- 8
- 57
- 96