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
votes
2 answers

Understanding the limitations of the bignumber.js library

I have recently found the bignumber.js library: source: https://github.com/MikeMcl/bignumber.js What I'm not sure of is if there is a limit to how big the number operations can be? I have been looking into the documentation, trying to find sources…
Webeng
  • 7,050
  • 4
  • 31
  • 59
-1
votes
1 answer

A mod B, A and B are very large numbers

I want to know if A and B are relatively prime using Euclidean Algorithm. A and B are large numbers that cannot be stored in any data type(in C), so they are stored in a linked list. In the algorithm, the operator % is used. My question is, is there…
I. Yuson
  • 1
  • 1
-1
votes
2 answers

How to sum big numbers

I am trying to put together a program, which would sum extremely big numbers. Unfortunately I am stuck - it doesn't return any result, even if I comment out malloc & realloc (where the compiler seems to be failing). Any ideas? My code: #include…
gopi
  • 24
  • 1
  • 9
-1
votes
1 answer

Passing Big Numbers as a parameter in a function?

I'm trying to write a function that calculates all the prime factors of a given number n. I have that part down, however, I don't know how to do this with really big numbers like 244825004422. How could I optimize myPrimeFactors method to work…
Binka
  • 31
  • 1
  • 5
-1
votes
1 answer

how java.bigInteger valueOf works?

I'm making a project concerned big numbers without BigInteger, BigDecimal etc. I've managed to do all the basics but now I need to add ability to count factorials. My BigNumber stores data as int[] . Here's a sample solution with BigInteger but I…
owca
  • 1
  • 1
-2
votes
1 answer

Problem with dividing in custom big numbers class (C++)

I'm writing a custom arithmetics for a big numbers class (unlimited lenghth of a single number) Dividing using multiple decrementing numer A by B fails when A is much grater than B. I'm trying to implement written division, but i find it too…
Chris
  • 5
  • 3
-2
votes
1 answer

Python 3 float problems?

I was trying to do the follow calculation in python 3: https://i.stack.imgur.com/f5y7z.png add with: https://i.stack.imgur.com/Txoya.png that should return 0 (images were made in wolframalpha). When I try to do the same calculation in…
aesthetic
  • 41
  • 1
  • 5
-2
votes
1 answer

how to check that, is number square of another number, python3

numbers are real long, (for example n=341235129628026803631240389584456), I tried that way: if n**(1/2)-floor(n**(1/2)) == 0: true but program count n**(1/2) like 1.8472550707144556e+16, but i need number without e
-2
votes
3 answers

Raising large number to large power and mod it by a large number?

I am stuck with probably simple question. I got 3 large numbers(A,B,C), all integers and i need to do the following: power A to B and modulo the result by C, and then check if the result is equal to 1. Here's my code: double power =…
Z1kkurat
  • 45
  • 6
-2
votes
1 answer

Big Integer Header

Wrote a header named big number that store big numbers as a string and do all mathematical operations on it but I can't override the operator / in a good and fast way, please help me on it. class BigNumber { string Number; bool Sign; bool…
M.Fooladgar
  • 374
  • 1
  • 4
  • 17
-2
votes
2 answers

multiply number in strings c++

what I'm looking for is using simple math on number in string I'm trying to find the factorial of 100 and it's really big to put it in int or long long so I searched and found that string is the best Solution but I can't multiply numbers in…
MD9
  • 90
  • 1
  • 7
-3
votes
2 answers

Subtraction in place of Division: How to approximate division with subtraction

I want to do division but with subtraction. I also don't necessarily want the exact answer. No floating point numbers too (preferably) How can this be achieved? Thanks in advance:) Also the process should almost be as fast as normal division.
dickson
  • 11
  • 3
-3
votes
1 answer

Basic multiplication in c by changing starting code

I need to take the following code and replace the calls using mpz_ with my own code. void Product32(void *a, void *b, void *c, unsigned int wa, unsigned int ba, unsigned int wb, unsigned int bb, unsigned int *wc, unsigned int *bc){ mpz_t…
sydwys8
  • 1
  • 1
-3
votes
1 answer

How to implement bignum addition/multiplication from scratch in C++

I have started writing a bignum library, with a vector of shorts to represent the value, a print function, and negative number support. However, I cannot find a good way to implement long addition, like this: 123 +123 ---- 246 The latest code I…
built1n
  • 1,518
  • 14
  • 25
-4
votes
1 answer

Big number adding function crashes program

I wrote an adding function for very large numbers and when it gets called, the program crashes. I am assuming that it has to do with the carrying. Here is the code: char * bigadd(char a[], char b[]){ int i, temp; char useadd[MAX]; char usea =…
simonb
  • 17
  • 6
1 2 3
24
25