计算机如何处理大于 int 大小的数字
How do computers handle numbers greater than the size of int
我知道有 long 和 unsigned long 可用,但如果我要对天文数字进行计算,计算机如何处理这些?
我想如果我使用的是 C,那么在那种情况下 int 的大小确实取决于平台,但即使在那种情况下,大小也不能是 64 位,对吗?
对于java我猜大小是有限的,那他们是怎么做到的?
谢谢
我想这就是您要找的:
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 whose 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.
https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
我知道有 long 和 unsigned long 可用,但如果我要对天文数字进行计算,计算机如何处理这些?
我想如果我使用的是 C,那么在那种情况下 int 的大小确实取决于平台,但即使在那种情况下,大小也不能是 64 位,对吗?
对于java我猜大小是有限的,那他们是怎么做到的?
谢谢
我想这就是您要找的:
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 whose 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.
https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic