[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: 5.1 rc mod giving -0 (never just 0)
- From: Asko Kauppi <askok@...>
- Date: Sun, 22 Jan 2006 23:25:47 +0200
Not sure if this is worth bringing up, but...
Lua 5.1-rc always gives "-0" for zero mod results. Since PIL2 says
"the result always having the same sign as the second argument", this
raises my eyebrowns.
Also, it would certainly be more 'natural' for a programmer to
receive 5%5 == 0, although functionally the 'sign' of zero does not
hurt.
OS X 10.4.4 PowerPC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc.
build 5026)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
-asko
Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio
> print(5%(-2))
-1
> print(5%(-5))
-0
> print((-5)%(-5))
-0
> print(5%5)
-0
> print(0%5)
-0
>