[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: About big integers in Lua 5.3.
- From: Sean Conner <sean@...>
- Date: Fri, 15 Jan 2016 02:09:41 -0500
It was thus said that the Great Dirk Laurie once stated:
> 2016-01-14 22:39 GMT+02:00 Tom N Harris <telliamed@whoopdedo.org>:
> > Lua doesn't hide the imprecision of floats, nor do I think it should
> > hide the overflow of integers.
>
> I grew up in a time when integer overflow caused a program to
> crash unless you had explicitly set a CPU flag that would make
> it wrap around. Don't modern machines have such a flag, only
> by default it is off? And if so, is the feature accessible from C?
The only architecture I know of [1] that can do that is the VAX
architecture [2]. The MIPS can trap overflow, but it requires the use of
separate instructions (ADD instead of ADDU that every C compiler seems to
use). Such features aren't necessarily accesible from C in a portable
manner, although compilers might support options to enable/disable such
actions.
I did some microbenchmarks on this [3] and it doesn't seem to add that
much overhead on modern machines [4].
-spc
[1] I'm not saying it's the only one, just that it's the only one I know
of.
[2] Sweet system and the most regular and orthogonal CISC architecture
I've come across.
[3] http://boston.conman.org/2015/09/07.1
[4] Intel.