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
Bignum calculations in python gives wrong output
I know that python 3.x supports bignum natively..
But it shows wired output for some set of numbers
r = 1152500320511525003205
x = 23
y = r/x
mod = r%x # zero
print ( y*x == r) # False
The last statement shall give out true as x divides r in r%x…

Shady Atef
- 2,121
- 1
- 22
- 40
0
votes
0 answers
Handling matrices using Brobdingnag package
I need to build a matrix with extremely small entries.
So far I realized that the fastest way to define the kind of matrix that I need is:
Define a vectorized function of coordinates:
func = function(m,n){...}
Combine every possible coordinate…
0
votes
3 answers
How can I input very large numbers(more than 200 digits) in C?
I want to input very large numbers in C.And I also want to calculate the sum of its digits.Is there a way to input very large numbers?
Here is my Code.
#include
main() {
int sum=0,rem;
int a;
printf("Enter a number:-");
…

Gayantha Akalanka
- 25
- 8
0
votes
0 answers
number_format inaccurate in PHP
PHP function number_format seems to not be reliable for big numbers. It's probably a rounding issue as explained on PHP - number_format issues
The function money_format() behaves similarly.
This is the case:
$n = 1000000000000000001;
echo "\nn =…

Juan Ignacio Pérez Sacristán
- 604
- 1
- 4
- 20
0
votes
1 answer
What is the difference between `Rational` and `BigNum` implementations
There are a lot of such types for many languages. As far as I know, here is how it works.
Rational just stores two separate digits for numerator and denominator (like 3 and 10 for 0.3).
BigNum stores each digit of the number in some kind of an…

FrozenHeart
- 19,844
- 33
- 126
- 242
0
votes
1 answer
Ruby error "bignum too big to convert into long"
I'm trying to generate an RSA keypair in ruby with:
OpenSSL::PKey::RSA.generate(aReallyLongBignum, 65537)
but I am getting the following error:
bignum too big to convert into long
However it works in python using RSA.construct. Is there any way for…

Sawyer Charles
- 126
- 5
0
votes
1 answer
Big integer is not being rounded
Using the following library:
http://jsfromhell.com/classes/bignumber
my big integer is not being rounded.
My code is the following:
x=1234.56;
y = new BigNumber(x);
document.write("
1 "+Math.round(x) +"
"); document.write("
2…
1 "+Math.round(x) +"
"); document.write("
2…

JORd
- 109
- 1
- 10
0
votes
2 answers
How to fix "largeNumber^5+1 = largeNumber^5" in Java
I am searching for a, b, and c such that a^5+b^5 = c^5. My program yields 2000^5+1= 2000^5. Why is this happening and how to fix it?
public class Euler {
public static void main(String[] args) {
long i=0;
int power = 5;
…

sixtytrees
- 1,156
- 1
- 10
- 25
0
votes
0 answers
converting Bignum to double
How to convert a Bignum value into a double value and so can do all the ordinary arthiemetic operations on it. I'm trying the following code but it seems to be foolish to do it in this way. So, I'm asking about if a Todouble() operator exists…

Esraa
- 1
- 2
0
votes
1 answer
doing math on files
I am writing a program in C for file compression. The method i am trying to use involves doing math on the file as if it were one long number. Can anyone recommend a bignum library that would not try to do all of that in ram, but rather let me do…

Mobius
- 2,871
- 1
- 19
- 29
0
votes
1 answer
Trying to get #include to run in my program
In my code I'm getting a fatal error of :
fatal error: gmpxx.h: No such file or directory|
I'm trying to use the The GNU Multiple Precision Arithmetic Library, but I'm having trouble trying to get the library downloaded an working in the right…

Joe
- 13
- 4
0
votes
1 answer
Insert an `__asm__` block to do a addition in very large numbers
I am doing a program, and at this point I need to make it efficient.
I am using a Haswell microarchitecture (64bits) and the 'g++'.
The objective is made use of an ADC instruction, until the loop ends.
//I removed every carry handlers from this…

Hélder Gonçalves
- 731
- 6
- 19
0
votes
1 answer
Can ZZ from NTL be used to represent big numbers needed fro crypto?
I'm trying to implement Threshold Elgamal and I need a library that supports both big numbers and polynomials. For polynomials I would use NTL and for big numbers I would choose openssl bignum. The problem is that the big numbers must be the…

guglielmo london
- 137
- 6
0
votes
2 answers
Way to count number of digits in a Bignum
I am writing a ruby method as follows:
def build_array(word)
word_copy = word
array = []
length = word_copy.length
for i in 1..length do
array[i] = word_copy % 10
word_copy = word_copy/10;
end
puts array
end
I would like to…

Thalatta
- 4,510
- 10
- 48
- 79
0
votes
2 answers
Simple floating point maths in JavaScript
I need to do some basic floating point math stuff (adding and multiplying money) for a website UI. I know that Javascript floats aren't accurate because of how they're stored, but I also know that somehow, it's possible to get the level of accuracy…

I wrestled a bear once.
- 22,983
- 19
- 69
- 116