Re: [PHP] Subtracting Large Numbers

2006-02-19 Thread Rory Browne
I would guess integer overflow. On 2/17/06, Bruce <[EMAIL PROTECTED]> wrote: > > I am puzzled by the following code: > > print "MaxInt=".PHP_INT_MAX; > $AA = -190668411; > $BB = -2181087916; > print "AA=$AA"; > print "BB=$BB"; > $AA = (int)$AA + (int)$BB; > print "AA+BB=$AA"; > ?> > > On some sys

[PHP] Subtracting Large Numbers

2006-02-18 Thread Bruce
I am puzzled by the following code: MaxInt=".PHP_INT_MAX; $AA = -190668411; $BB = -2181087916; print "AA=$AA"; print "BB=$BB"; $AA = (int)$AA + (int)$BB; print "AA+BB=$AA"; ?> On some systems, I get: MaxInt=2147483647 AA=-190668411 BB=-2181087916 AA+BB=-2338152059 On others, I get: MaxInt=2147