On Tue, 4 Mar 2003, George Schlossnagle wrote:
> Interesting.
>
> I don't know what the ISO standard say, but mathematically a a % b will
> always return you an integer 0 <= a%b < b (since there are no negative
> numbers in canonical representation of Z/bZ). I guess perl/python/tcl
> ddecided to adhere to the mathematical definition.
ISO C truncates towards zero. It specifically says in 6.5.5
Multiplicative Operators:
If the quotient a/b is representable, the expression (a/b)*b
+ a%b shall equal a.
So -27 % 7 yields -6.
- Sascha
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php