lua-users home
lua-l archive

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


On 06/07/2013 21.36, Roberto Ierusalimschy wrote:
There are two formats for reading numbers: io.read("*n") always reads
a floating-point number, and io.read("*i") always reads an integer.
So, usually there is no need to convert anything.

Ah, good.

Just after the section "Mathematical Functions", the manual says this:
   "Unless stated otherwise, all functions in this library operate with and
    return floating-point numbers."

In that case it would probably be useful to retouch the description of math.floor (etc.) to avoid them being interpreted as returning an integer:

  Returns the largest integer smaller than or equal to x.

(yes, it doesn't say "as an integer number" but the "integer" word in the above sentence could be confusing.)

> There is a new function, math.ifloor, that returns the floor as an integer.

Right, missed that :-)

--
  Enrico