[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Overflow of hex vs decimal integer literals
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 23 Feb 2017 07:43:42 +0200
2017-02-23 2:45 GMT+02:00 Daurnimator <quae@daurnimator.com>:
> TIL that hex literals don't overflow into floats:
What is TIL supposed to mean in this context?
> Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
>> 0x7fffffffffffffff
> 9223372036854775807
>> 0x7ffffffffffffffff
> -1
>> 0x7fffffffffffffffff
> -1
>> 0x2222222222222222
It looks as if the last 16 hex digits are kept and the
rest ignored. Not a clever option for decimal.
> 0x333333333333330000000000000001
1
One could look at the Lua source to see whether it is a Lua
or a C feature.