[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Overflow handling in lua
- From: Peng Zhicheng <pengzhicheng1986@...>
- Date: Sun, 08 Jul 2012 11:26:32 +0800
于 2012-7-8 10:58, meino.cramer@gmx.de 写道:
Javier Guerra Giraldez <javier@guerrag.com> [12-07-08 04:48]:
On Sat, Jul 7, 2012 at 10:07 AM, Eike Decker <zet23t@googlemail.com> wrote:
I think it would stop icrementing at 2^48 or somewhere in that range..
more like 2^53
--
Javier
That is :
a=0
while a==a do
a=a+1
end
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
mcc
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.