Questions tagged [largenumber]

Very large numbers often occur in fields such as mathematics, cosmology, cryptography and statistical mechanics. That numbers are significantly larger than those ordinarily used in everyday life, for instance in simple counting or in monetary transactions. The term typically refers to large positive integers, or more generally, large positive real numbers, but it may also be used in other contexts.

In computer science, arbitrary-precision arithmetic, also called bignum arithmetic, multiple precision arithmetic, or sometimes infinite-precision arithmetic, indicates that calculations are performed on numbers which digits of precision are limited only by the available memory of the host system. This contrasts with the faster fixed-precision arithmetic found in most arithmetic logic unit (ALU) hardware, which typically offers between 8 and 64 bits of precision.

Several modern programming languages have built-in support for large numbers (also known as infinite precision integers or bignums), such as , , and . Other languages which do not support this concept as a top-level construct may have libraries available to represent very large numbers using arrays of smaller variables, such as and class or package.

Other languages have libraries available for arbitrary-precision integer and floating-point math. Rather than store values as a fixed number of binary bits related to the size of the processor register, these implementations typically use variable-length arrays of digits.

453 questions
-1
votes
2 answers

Run a calculation with a huge base and exponent in java

I need to do a very large calculation in a blind signature scheme to get a blinded token. I have tried this in java using the BigInteger class. I believe my current code is correct as it runs but ends up throwing an exception as the number would…
lb-99
  • 33
  • 5
-1
votes
1 answer

printing a very large number in python takes forever

I wanted to calculate a very large number and since python supports arbitraryly large numbers I thought that's perfect. So, here it is: import math x=2**24 y=3840*2160 z=x**y print("z is calculated") print(z) Well, the last I see is "z is…
U. W.
  • 414
  • 2
  • 10
-1
votes
1 answer

Number of valid sequences

A sequence of n numbers is considered valid if the sequence begins with 1, ends with a given number j, and no two adjacent numbers are the same. Sequences may use any integers between 1 and a given number k, inclusive (also 1 <= j <= k). Given…
-1
votes
2 answers

I'm having problem storing 10^18 as a float

I'm writing a program which must take in an integer, N, in range 3<=N<=10^18. This is one of the operations I have to perform with N. final=((0.5*(pow(2,0.5))*(pow((pow(((N/2)-0.5),2)+pow((N/2)-0.5,2)),0.5)))-0.5)*4; N is such that final is…
tnd11
  • 19
  • 5
-1
votes
1 answer

Comparing large numbers of values using php arrays

I have to compare two very large number of values, for that I put them in arrays but it didn't work. Below is the code I use. Is this the most efficient way? I have set the time and memory to unlimited as well. error 101 (connection reset) unknown…
Aamir
  • 273
  • 2
  • 5
  • 10
-1
votes
2 answers

Python Comparing Large Numbers

How does one compare large numbers python? I have the following two numbers: x = 99 ^ 85, y = 73 ^ 62. Computing both numbers in the python interpreter gives the following results: >>> x = 99 ** 85 >>>…
Michael
  • 713
  • 10
  • 27
-1
votes
1 answer

Inconsistency with Large Number Subtraction

I'm relatively new to C++, and I'm attempting to create a set of arithmetic functions that are able to handle large numbers, using a struct called biggie that handles the numbers like a string. I'm currently having difficulty with the subtract…
JaredCubilla
  • 538
  • 1
  • 8
  • 24
-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

Binary powering giving me a wrong result

I have a problem with my binary powering function. Variable which contains the result overflows while performing multiplication and gives me a wrong result. It happens when the source value is greater than 4,312,952,827. So how do I solve this…
Simon Rusinov
  • 29
  • 1
  • 5
-1
votes
1 answer

Is it possible to do bitwise operations (AND, OR, XOR) for large numbers represented by character-arrays?

I understand that bitwise-operations on numbers represented by native data-types in C, is a piece of cake. However, is there a way to do the same for large numbers represented by character arrays? I tried googling, but surprisingly couldn't find an…
Ajay Garg
  • 79
  • 1
  • 1
  • 4
-1
votes
1 answer

Division between a large numbers (Above long long) and a single integer

I am trying to divide a number by an integer as suggested in the title, and i am having a hard time doing so. I was thinking about inserting the big number's digits into a vector then repeatedly substracting said digit from the vector until it is…
-1
votes
1 answer

InputFilter or TextWatcher for EditText which handle large integer(like year..)

I need to make handler for EditText in my app and this EditText accept year between 1980 till 2015. I've found a very good solution for EditText for day(s) and month(s) in this link. But Unfortunately it doesn't work for large numbers like years!…
SDG69
  • 161
  • 1
  • 4
  • 19
-1
votes
1 answer

Data type for storing large numbers

I have a program which needs to store several numbers. The largest one can be of the order 10^15. How should I go about storing the number. I'm using Gcc 4.3.2 compiler.
Abhishek
  • 1,717
  • 6
  • 22
  • 39
-2
votes
2 answers

How to read two large numbers (bigger than long long) , separated by a space, in C?

So, given this input: 43890758927436598726435872648957245892643 834589723465892743658972346587243568274599 I should assign each of these two to a linked list. I actually have no clue. I know in C++ I can use the getline method. Is there something…
-2
votes
1 answer

Multiplying two ridiculously large number stored in an array of chars C++

I have an assignment which requires me to write a program that multiplies two large numbers that are each stored in an array of characters with the maximum length of 100. After countless efforts and debugging and multiplying 10 digit numbers step by…
user14759117