Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c
| From: | Michael Walter | Date: | Sun, 22 Feb 2004 22:57:14 +0000 |
| Subject: | Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8071@lists.php.net to get a copy of this message | ||
Sterling Hughes wrote:
Microsoft SpecificGeorge Schlossnagle wrote:no, -22 % 7. Well, I was sort of confused by theOn Feb 22, 2004, at 5:15 PM, Derick Rethans wrote:No, it's implementation-defined though if one of the operands is negative, IIRC.On Sun, 22 Feb 2004 cm@leetspeak.org wrote:Doesn't the rval in modulus need to be unsigned?It's generating an idivl, which gives you an exception if the (signed) result is too large (a.k.a. integer overflow). Did you notice your compiler warning "this decimal constant is unsigned only in ISO C90"? ;)Yes I did+2147483648 is: 10000000 00000000 00000000 00000000. -2147483648 is too large to be represented by a signed integer (as it would be ~(+2147483648) + 1,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.
In Microsoft C++, the result of a modulus expression is always the
same as the sign of the first operand.
END Microsoft Specific
remark on MSDN.
Cheers,
Michael