[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Floats and %d
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 21 Jul 2015 09:28:29 -0300
> > The OP's problem can be solved with something much less ambitious.
> > Replace the first line above by:
> >
> > case 'd':
> > lua_Integer n = (lua_Integer)luaL_checknumber(L, arg);
> > addlenmod(form, LUA_INTEGER_FRMLEN);
> > nb = sprintf(buff, form, (n);
> > break;
> > case 'i':
> >
> > My question was: which of the other five cases should also be
> > treated like case 'd?
> >
>
> IIUC, this would break it for some numbers between 2^53 and 2^63
Most of them, actually. It also has undefined behavior for numbers
larger than 2^63. (On most machines this "undefined behavior" manifests
as plainly wrong results.)
-- Roberto
- References:
- Floats and %d, Rena
- Re: Floats and %d, Parke
- Re: Floats and %d, Rena
- Re: Floats and %d, Roberto Ierusalimschy
- Re: Floats and %d, Rena
- Re: Floats and %d, Parke
- Re: Floats and %d, Dirk Laurie
- Re: Floats and %d, Tim Hill
- Re: Floats and %d, Dirk Laurie
- Re: Floats and %d, Daurnimator