lua-users home
lua-l archive

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



On Jun 24, 2014 11:20 AM, "Roberto Ierusalimschy" <roberto@inf.puc-rio.br> wrote:

> If a program
> specifices 3.2 as a character index in a string, is it useful to
> silently truncate that to 3? Or maybe it would be better to throw an
> error in that case?  In the rare cases that the programmer really wants
> to truncate, that probably should be done explicitly.

In inexact floating point we say not to compare for equality with 3.0; instead check for a result within epsilon of 3.0. But with truncation, (3.0-epsilon) is 2, right? Does that affect any real programs?

Instrumenting 5.2 to check for non-integers in running code might be interesting.