lua-users home
lua-l archive

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

> So, for best efficiency, I guess programmers will have to be careful
> to avoid unnecessary int -> fp conversions


> Suppose I read a large number of values (some integer, some not)
> from a text file into a table and then perform extensive
> computations on them.
> Should I multiply each value by 1.0 (or add 0.0), to pre-convert all
> of them to fp, to avoid slowing down the following computations
> compared to Lua 5.2?

There are two formats for reading numbers:"*n") always reads
a floating-point number, and"*i") always reads an integer.
So, usually there is no need to convert anything.

> A doubt: does math.floor return an fp value or an integer?
> (the manual could be interpreted as the latter)

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."

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

> Lastly, I see no bit64 ops in the manual; will they come?


-- Roberto