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

From: Date: Sun, 22 Feb 2004 22:06:40 +0000
Subject: Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-8064@lists.php.net to get a copy of this message
Derick Rethans wrote: > On Sun, 22 Feb 2004, Derick Rethans wrote: > > >>On Sun, 22 Feb 2004, Andi Gutmans wrote: >> >> >>>Huh? What platform crashes? Can you send reproducible C code? >> >>int main(void) { >> long a = -2147483648; >> long b = -1; >> long c; >> >> c = a % b; >>} > > > Does anybody has a clue *why* this gives a floating point error btw? 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"? ;) +2147483648 is: 10000000 00000000 00000000 00000000. -2147483648 is too large to be represented by a signed integer (as it would be ~(+2147483648) + 1, which gives once again: 10000000 00000000 00000000 00000000), so the result would be too large to be represented as a signed integer, too. Cheers, Michael

« previous php.internals (#8064) next »