Comments on: Question of the Week: How can computers calculate exponential math without overflow errors? http://blog.superuser.com/2012/07/30/question-of-the-week-how-can-computers-calculate-exponential-math-without-overflow-errors/ The Super User Community Blog Mon, 05 Dec 2016 07:34:06 +0000 hourly 1 https://wordpress.org/?v=4.5.6 By: Fox http://blog.superuser.com/2012/07/30/question-of-the-week-how-can-computers-calculate-exponential-math-without-overflow-errors/#comment-27088 Tue, 31 Jul 2012 20:52:25 +0000 http://blog.superuser.com/?p=5037#comment-27088 Whoops. I see this was answered in greater depth in the second half of the OP.

]]> By: Fox http://blog.superuser.com/2012/07/30/question-of-the-week-how-can-computers-calculate-exponential-math-without-overflow-errors/#comment-27087 Tue, 31 Jul 2012 20:42:21 +0000 http://blog.superuser.com/?p=5037#comment-27087 The calculations are handled by software (sometimes native data types) that can deal with numbers of arbitrary length. These are commonly referred to as “BigDecimal” or “BigInteger” (though I wouldn’t be surprised if some large but bounded systems used these names as well).

]]> By: Dennis http://blog.superuser.com/2012/07/30/question-of-the-week-how-can-computers-calculate-exponential-math-without-overflow-errors/#comment-26861 Mon, 30 Jul 2012 11:27:47 +0000 http://blog.superuser.com/?p=5037#comment-26861 @sblair is correct: This has nothing to do with Stack Overflow.

The concern here is integer overflow, since the maximum representable value of a 64-bit register is 2 ^ 64 – 1 = 18,446,744,073,709,551,615.

In contrast, the result of 855 ^ 2753 would need 23,814 bits to be represented.

]]>
By: sblair http://blog.superuser.com/2012/07/30/question-of-the-week-how-can-computers-calculate-exponential-math-without-overflow-errors/#comment-26851 Mon, 30 Jul 2012 09:45:14 +0000 http://blog.superuser.com/?p=5037#comment-26851 I don’t think this has anything to do with a stack overflow. It is simply that the numerical range of 64-bit IEEE 754 floating point numbers isn’t large enough to contain 855^2753. The possible range is approximately −10^308 to +10^308.

]]> By: Torleif http://blog.superuser.com/2012/07/30/question-of-the-week-how-can-computers-calculate-exponential-math-without-overflow-errors/#comment-26848 Mon, 30 Jul 2012 08:59:23 +0000 http://blog.superuser.com/?p=5037#comment-26848 For the beginning of this post, isn’t ‘stack overflow’ something else than the ‘overflow’ mentioned here? As far as I know, ‘Stack overflow’ is when there have been too many method calls (infinite call loop for example), while a regular overflow in this context is when you have a number which is too big for a 32/64-bit integer and it overflows, either by ‘looping around’ or failing or whatever.

]]>