----- Original Message -----
From: "Jonathan Rosenberg" <[EMAIL PROTECTED]>
To: "Jason Teagle" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 3:18 PM
Subject: RE: [PHP] Re: PHP & Hex Numbers


> > When doing arithmetic in code, you should always be
> > prepared to handle signed and unsigned.
>
> Thanks for the reply.  I figured something like this was going
> on.
>
> But, how does one become "prepared" to handle signed & unsigned
> integers?  Is PHP consistent regarding signed/unsigned when it
> does arithmetic on integers?

I don't know the answer to that question (yet). What I meant was, we should
always be thinking about numbers possibly being negative when treated as
signed (which I believe is the default when using numbers for arithmetic),
and if necessary account for it. For example, testing if $result < 0 would
alert us to the fact that it is probably too large for a signed 32-bit
integer, and needs special handling. I don't know if PHP supports a larger
integer type (64 bits, for example) - if it does, that helps since you can
cast to that type to ensure it is added correctly.

--------------------------------------------
_ _
o o    Jason Teagle
 <      [EMAIL PROTECTED]
 v
--------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to