An overflow question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

An overflow question

Kirill Orlov
Some functions or operations can cause an upper limit overflow error. For example

compute factorial_171= exp(lngamma(171+1)). /*171!

returnes
>Warning # 612
>The argument to the EXP function is too large.  The maximum is about 709.78.
>The result has been set to the system-missing value.

My question: Is that behaviour, in particular the limit for value in the above example, will be different in SPSS:
1) On 32 vs 64bit OS?
2) Different versions of SPSS?
3) Different machines/processor brands?

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: An overflow question

Jon Peck
The overflow comes from the nature of double precision floating point arithmetic following the IEEE standard.  It does not depend on bitness or the SPSS version or the processor (at least standard processors).  However, in some cases, the numerical algorithms used in computation may evade the calculation of extreme numbers, and the exact point of failure may vary a little with different compilers or numerical microcode.  Specialized computations can be written to store extreme values in ways more complex than the IEEE standard at the cost of performance and complexity, but these are not used in most software.

The Python standard library includes a Decimal data type that has arbitrary precision and range.  Here's an example, where I set the maximum value very high and then exponentiate e**10.
import decimal
decimal.getcontext().Emax=99999999999999999999999999999999
decimal.Decimal(1e10).exp()
>>>Decimal('1.077750607958564910214246296E+4342944819')

Then I upped the precision and did this again.
decimal.getcontext().prec=200
decimal.Decimal(1e10).exp()
Decimal('1.0777506079585649102142462959127578275590291694163287576181922364495837146930024107520340477597156774715590392968516608400031194644808749664643474959159299948728404036214323478773944786940709153291760E+4342944819')



On Sun, Dec 30, 2018 at 10:28 AM Kirill Orlov <[hidden email]> wrote:
Some functions or operations can cause an upper limit overflow error. For example

compute factorial_171= exp(lngamma(171+1)). /*171!

returnes
>Warning # 612
>The argument to the EXP function is too large.  The maximum is about 709.78.
>The result has been set to the system-missing value.

My question: Is that behaviour, in particular the limit for value in the above example, will be different in SPSS:
1) On 32 vs 64bit OS?
2) Different versions of SPSS?
3) Different machines/processor brands?

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD