lua-users home
lua-l archive

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

On Jan 28, 2008 5:46 AM, Matthew Paul Del Buono <> wrote:
> Some of you will think I'm on crack for saying that there are an infinite number of solutions

Halfway there.  I'm used to the C definition of modulo being a
remainder, which may or may not be the original source of the
"problem".  I'm also used to the mathematical answer, where the modulo
operator takes numbers and maps them into a discrete ring.  In that
case, there is an infinite set of numbers for which this holds:

x + ny = x (mod y) for all integers n, x, y

but they /all/ map to a single value, an integer in the range [0, y).
So I think it's more corect to say that there are an infinite number
of problems that all map to the same solution.  It makes sense that
one method is the mathematical definition and another is the CS
definition, but the oddity about NaN causes differing behaviors is
still weird, IMO.