Ask Your Question

numbers > 2.8 billion?

asked 2019-05-12 20:03:43 +0200

JosephFG gravatar image

How can I enable very large integers in Calc?

edit retag flag offensive close merge delete


Note: I notice I can get larger than 2.8 billion, but not much. I need trillions and beyond!!

JosephFG gravatar imageJosephFG ( 2019-05-12 20:07:03 +0200 )edit

3 Answers

Sort by » oldest newest most voted

answered 2019-05-12 22:35:49 +0200

ajlittoz gravatar image

Developers could answer better than I can.

It is likely that integer arithmetic is done with 32-bit integer, allowing for a maximum absolute value of ~2.1 10^9. Numbers larger than this limit are handled with iEEE 754 floating point format. It is likely that "double" type was chosen for consistency. This length allows for 53-bits precision. Provided, you don't require too large a magnitude, you can consider you have a slightly larger integer (the exponent does not cause flushing digits out of the significand). You must also take care of not creating non-integer numbers, i.e. a fractionary part.

It is then possible to circumvent the limitations of pure integer range but you must be very cautious and make a thourough numerical analysis of your formulas to avoid all pitfalls with floating-point arithmetic.

If you want to reliably compute large numbers, try using multiprecision packages or applications. In case you want to stay with Calc, consider your numbers as polynomials or billion-radix numbers and use 2 cells to represent them. You'll have to manage overflow yourself. Addition and subtraction are easy; beware for multiplication and division (you may have to reduce the radix to avoid overflow).

edit flag offensive delete link more


Now there is an interesting idea. I will have to think about this. Thanks.

JosephFG gravatar imageJosephFG ( 2019-05-13 04:29:35 +0200 )edit

answered 2019-05-12 23:04:22 +0200

updated 2019-05-13 17:17:32 +0200

@JosephFG, already tried to format and increase the column width, before typing the billions

image description

edit flag offensive delete link more

answered 2019-05-13 02:17:34 +0200

Lupp gravatar image

As long as you only ned to show and store the numbers in any representation, you can use texts consisting of decimal digits and representing numbers as if printed. Calc accepts 65535 characters per cell. That should be enough even if you use a dyadic representation.
However, neither Calc nor common hardware support calculations for that kind of numbers.
Hardware may handle 64-bit integers (signed or unsigned). LibreOffice Basic only supports 32-bit integer types, and Calc uses IEEE 754 Double for all kinds of numbers. That's a 64-bit floating-point format which, if used for integers, can represent values up to about 15 decimal digits exactly (52-bit mantissa).
Beyond that you cannot "enable" anything in Calc.
For calculations with arbitrary precision (or integers of arbitrary length) you need mathematical software like Mathematica or Maple or, if it should be free and open, Maxima, e.g.

edit flag offensive delete link more


Thanks, I will try one of those.

JosephFG gravatar imageJosephFG ( 2019-05-13 03:39:04 +0200 )edit

(@ajlittoz already told it in other words.)
Just to put it completely clear: It's not a question of the order of magnitude Double format can handle the range of scaling factors from about 10^-308 through 10^+308. Thats a lot. The quesetion is if a precision of 52 significant bits is sufficient.

Lupp gravatar imageLupp ( 2019-05-13 08:20:08 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-05-12 20:03:43 +0200

Seen: 130 times

Last updated: May 13 '19