lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

于 2012-7-8 10:58, 写道:
Javier Guerra Giraldez <> [12-07-08 04:48]:
On Sat, Jul 7, 2012 at 10:07 AM, Eike Decker <> wrote:
I think it would stop icrementing at 2^48 or somewhere in that range..
more like 2^53


That is :

     while a==a do

will run forever and 'a' will stay at its
maximum without changing then anymore...????
Or does it abort with an error? Or what else?

I am confused....

Best regards

yes, when a is incresed to 2^53, it won't change then on.

but this is not saying that 2^53 is the maximum number.
it is just the maximum value that has a 0 exponent for
double precision floating point numbers according to IEEE 754.

in other words, (2^53+1) == (2^53). but (2^53+2) > (2^53)

for details, you may refer to IEEE 754 standard or wikipedia.

one more word,
the floating point numbers have a defined INFINITIVE value,
so there is not the similar `overflow' concept as for integers.

if a is `+1.#INF', then the result of `a+b' or `a-b' is defined to
be "+1.#INF" where b is a finitive number.