lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

It was thus said that the Great Daurnimator once stated:
> On 17 May 2016 at 12:57, Sean Conner <> wrote:
> >   You misunderstood me.
> >
> >         tonumber() always returns a double or nil if not a double
> >         math.tointeger() always returns an integer or nil if not an integer
> >
> > tonumber() isn't smart.  math.tointeger() isn't smart.
> >
> tonumber() should always parse numbers the same way lua would.
> If lua has literal integers, it should return integers
> If lua has literal doubles, it should return doubles.

  That I can accept.

> This keeps identities such as tonumber(tostring(mynumber)) == mynumber
> as well as reducing surprises.
> Yes there is a math.tointeger; perhaps you also want a math.tofloatingpoint()?

  Eh ... I can live without math.tofloatingpoint().  

  -spc (And I can live without math.tofp() as well ... )