lua-users home
lua-l archive

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


Hi,

On Jun 2, 2007, at 9:44 AM, gtravis wrote:

Howdy,
I am getting the following modulo result
> = 9%3
-0
Negative zero?  Has anyone seen this. Macintosh version?

It's still 0.
>=9%3
-0

>=9%3==0
true

>=9%3+0
0

Floating point formats do not use a two's complement representation, but a separate sign bit, so there are two representations for 0.0. The comparison operators threat them as the same value.

Some earlier computers (Control Data Cyber etc.) used one's complement for integers, so you had two representations of 0 there as well.




Gé Weijers