[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: integer/float size and signaling overflow (was Re: Integer division)
- From: William Ahern <william@...>
- Date: Mon, 26 Nov 2012 13:10:09 -0800
On Mon, Nov 26, 2012 at 12:00:14PM -0800, Sven Olsen wrote:
> > I'm growing more convinced that "wants precision in computation" is a
> > property of code, not of dynamically typed values. I know I may be a victim
> > of confirmation bias.
> >
>
> My own gut feeling is the same. But I'm unsure how one might implement such
> a code property in a high level language like Lua.
>
> Perhaps we could follow the _ENV model? Have an upvalue _PRECISION that's
> implicitly set to "float64" any time a new chunk in loaded. Meaning that
> inside that scope, numeric operations should overflow as 64-bit floats.
If we exclude the ability for an implicit declaration at load time, then
type coercion could happen at compilation time by selecting the appropriate
ops. Then there wouldn't be any run time cost to the expanded typing.
- References:
- Re: Integer division, Wolfgang Pupp
- Re: Integer division, Roberto Ierusalimschy
- Re: Integer division, Wolfgang Pupp
- Re: Integer division, Roberto Ierusalimschy
- Re: Integer division, Wolfgang Pupp
- Re: Integer division, Roberto Ierusalimschy
- Re: Integer division, Jay Carlson
- Re: Integer division, Roberto Ierusalimschy
- integer/float size and signaling overflow (was Re: Integer division), Jay Carlson
- Re: integer/float size and signaling overflow (was Re: Integer division), Sven Olsen