Questions tagged [bignum]

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.

362 questions
1
vote
1 answer

Math using OpenSSL BIGNUMs: How to calculate multiplicative inverse?

I'm having some issues with OpenSSL BIGNUMs. I'm trying to implement a basic ElGamal protocol. The problem i'm having is that some of these calculations are not returning the values i'm expecting! This is mostly obvious when i try to calculate a…
Chris C
  • 259
  • 2
  • 15
1
vote
1 answer

My Python code return different answers when it runs and when it is in step-by-step debugging

I try to write some code on Python2.7, which will able to implement a bignum arithmetic, using linear lists. I know, this is useless in Python, but it's my homework in collage. I write some working pieces of code, but problem is in dividing. I'm…
Pycz
  • 366
  • 3
  • 12
1
vote
5 answers

multiplying two large numbers in C / C++

I was trying to come up with the solution for that ... two large numbers, a and b are represented by char[] or char* and the goal is to multiply them into a third pointer, char* c: void multiply( const char* a, const char* b ){ int len_a =…
cybertextron
  • 10,547
  • 28
  • 104
  • 208
1
vote
0 answers

How can I install bignum lib for Node.js on Heroku?

I get the following error -----> Installing dependencies with npm > bignum@0.5.1 install /tmp/build_1xz3suiyqvjwh/node_modules/bignum > node-gyp configure build sh: node-gyp: not found npm ERR! error installing bignum@0.5.1 Error:…
lior hakim
  • 114
  • 1
  • 8
1
vote
5 answers

Convert Hex to Decimal when no datatype can hold the full number

I am working with a PIC microprocessor, in C. It's a 16F, so it can't hold integers larger than 32bits (unsigned int32 is the largest datasize available) From a reader, I receive a 5 byte ID code. To transmit it, I have to encoded to BCD, digit by…
Manuel Ferreria
  • 1,216
  • 1
  • 13
  • 23
1
vote
1 answer

Openssl, Invalid arguments ' Candidates are: int BN_set_word(bignum_st *, ?) '

I am using OpenSSL for a cuda project. I just imported all the project from win to linux (Eclipse) I solved all the dependencies except this annoying error: Invalid arguments ' Candidates are: int BN_set_word(bignum_st *, ?) ' for this…
elect
  • 6,765
  • 10
  • 53
  • 119
1
vote
2 answers

RangeError: bignum too big to convert into `long'

num = "0000001000000000011000000000000010010011000011110000000000000000" for n in 0...num.length temp = num[n] dec = dec + temp*(2**(num.length - n - 1)) end puts dec When i am running this code in irb the following error message is the…
aahlad
  • 13
  • 1
  • 3
0
votes
1 answer

How to find the log of a number?

I have a number (num1) which is 18 digits long. I am storing it in an integer array. I have another number (num2) which is also 18 digits long. This is also being stored in an integer array. I have to find the log of the first number to the base of…
Zer0
  • 2,171
  • 3
  • 17
  • 18
0
votes
1 answer

How do i get Math.Sqrt to return a Bignum and not a Float?

I'm trying to calculate the square root of a really big number in Ruby. The problem I have is that the Math.sqrt function looks like this sqrt(numeric) → float If I feed it a really big number, it will give me FloatDomainError: Infinity. What is the…
davorb
  • 613
  • 1
  • 9
  • 17
0
votes
3 answers

Arithmetic Operations on Very, Very Long Decimals

I've always been curious: how can I perform arithmetic operations on very long decimals--for example, calculating pi to the 3000th decimal place (especially in an imperative language)?
Daniel
  • 10,864
  • 22
  • 84
  • 115
0
votes
2 answers

Check if bit is set on BigNum

I have a bignum formatted like a string like this: "123456789123456789123456789" and I need to check if a specified bit is set. The components are single digits in this string. Usually I would do it like this if I wanted to check if bit 54 is set:…
monoceres
  • 4,722
  • 4
  • 38
  • 63
0
votes
0 answers

Unexpected results for addition big numbers with carry on GPU (OpenCL)

I am writing a function to add numbers of arbitrary length on GPU using OpenCL and Boost::compute as frontend. No error occurs when the numbers are not so big (4096 bits): Bits length: 4096 Limbs Size: 65 Result: [03, ffffffffffffffff,…
JML
  • 1
  • 2
0
votes
0 answers

Confusion around using double to represent very big numbers

I have a requirement to represent 256 bit whole numbers. Right now i'm using __uint128_t[2]. Check out the below code. #include int main() { __uint128_t a = 0xffffffffffffffff; a<<=64; a+=0xffffffffffffffff; double b = a; …
Knm
  • 55
  • 4
0
votes
0 answers

Code Segment changing value of variable without any human interference

Consider the code segment below Explanation - It performs division of two numbers n & d where size(d) <= 128 bits and 128 bits <= size(n) <= 256 bits. The data types are __uint128_t n[2], d[2], temp[8], q[2], temp_1. The values of n & d are obtained…
Knm
  • 55
  • 4
0
votes
1 answer

Is that possible to calculate power function of two BigNumbers in Javacard?

Consider I have two numbers a and b. Is that possible to calculate a^b inside a javacard? Few month ago I saw a master thesis (that I could not find it again!) who had used crypto resources like RSA engine in javacard to calculate BigNumber…
MJay
  • 987
  • 1
  • 13
  • 36