# Dealing with 1000 digit numbers

• Snowmachine
In summary, the author has problems with representing huge numbers in binary or float64 format, and also have problems with precision. There are several possible solutions, including using float64s with the exponent as an integer, using fractional representation, or writing an arithmetic package. For extremely large numbers, gmp may be the best option.

#### Snowmachine

Hi,
Mostly i work with Octave / Matlab but i am trying to get into python also.
Lately i have a couple problems where my numbers can't be represented in binary64 or float64 default format because they exceed the max of 1.8x10^308. Is there a common way people deal with this (without toolkits)?

Similarly i have some problems where i need more than 15 digits of precision after the decimal and sometimes this exceeds the default precision. For example if i specify "precision", 56 on [1/3] the 0.(3) repeating 3s eventualy turn into non-3s which is a digital artifact.

Any suggestions or workarounds to these problems in matlab/octave or python? (Without toolkit\$?) I feel like there may be something basic I am missing because it seems like this should be straightforward.
Thanks!

jedishrfu
jedishrfu
Thanks for the tips guys, I'll dig into these options.

berkeman and jedishrfu
Snowmachine said:
Lately i have a couple problems where my numbers can't be represented in binary64 or float64 default format because they exceed the max of 1.8x10^308.
If the huge absolute magnitude of the exponent is the problem, then you should consider carrying the mantissa in a float64, with the exponent as an integer in a second variable. Another technique is to represented the numbers as logarithms.

Snowmachine said:
Similarly i have some problems where i need more than 15 digits of precision after the decimal and sometimes this exceeds the default precision. For example if i specify "precision", 56 on [1/3] the 0.(3) repeating 3s eventualy turn into non-3s which is a digital artifact.
If each number is represented by a fraction, the ratio of two integers, then the implicit division that generates the artefact does not have to be executed until human readable output requires long division. You will get good at fraction arithmetic. You may need to apply Euclid's algorithm to simplify the fractions.

Both problems can also be solved by writing an arithmetic package that processes strings of numeric characters. Maybe keep the position of the decimal points in signed integer variables. There are many digit-by-digit computational methods available. You will get to revisit long multiplication, division and root extraction as used by the great human computers of the past.

If you really need speed, or have numbers with more than 10k digits, you should go for the gmp lib, rather than numeric strings.

## What are 1000 digit numbers?

1000 digit numbers are numbers that have 1000 digits. They can be any combination of digits from 0-9 and can range from 0 to 10^1000.

## Why do we need to deal with 1000 digit numbers?

1000 digit numbers are important in various fields such as cryptography, data encryption, and scientific calculations. They allow for more precise and accurate calculations and can represent extremely large values.

## How do we represent 1000 digit numbers?

1000 digit numbers can be represented in various ways, including scientific notation, binary, and decimal formats. In computer systems, they are usually stored as arrays of integers or as strings of characters.

## What are some challenges in dealing with 1000 digit numbers?

One of the main challenges in dealing with 1000 digit numbers is the precision and accuracy of calculations. Due to the large size of these numbers, even small errors can lead to significant differences in the final result. Additionally, these numbers can be difficult to work with and manipulate due to their size.

## Are there any specific tools or techniques for working with 1000 digit numbers?

Yes, there are various libraries and software programs designed specifically for working with large numbers, including 1000 digit numbers. These tools often use advanced algorithms and data structures to ensure accurate calculations and efficient manipulation of these numbers.