Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c

From: Date: Sun, 22 Feb 2004 23:03:37 +0000
Subject: Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-8072@lists.php.net to get a copy of this message
Andi Gutmans wrote:
At 23:49 22/02/2004 +0100, Michael Walter wrote: No, -2147483648 is the lower bound and 2147483647 is the upper bound for
signed integers. -2147483648 = 10000000000000000000000000000000 2147483647 = 01111111111111111111111111111111 it still doesn't explain the FPE here. What does explain it is that -2147483648 / -1 = 2147483648 which is too large.
Doesn't the rval in modulus need to be unsigned?
No, it's implementation-defined though if one of the operands is negative, IIRC.
I checked the standard (not very thoroughly I admit) and it seems to only be undefined for 0. The standard also seems to say that "truncation towards zero" (or rather, the resulting equality) is only guaranteed if a/b is "representable" (which it isn't in Derrik's special case, is it?).
Can someone check this on a non-intel CPU with a 32bit int? If an Athlon is non-intel enough for you, then there you have the same behaviour ;)
Cheers, Michael

« previous php.internals (#8072) next »