Re: Re: PHP & Hex Numbers

From: Date: Mon, 03 Jun 2002 14:16:54 +0000
Subject: Re: Re: PHP & Hex Numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-100396@lists.php.net to get a copy of this message
----- Original Message ----- From: "Jonathan Rosenberg" <jr@tabbysplace.org> To: "Jason Teagle" <jason@teagster.co.uk>; <php-general@lists.php.net> 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 < jason@teagster.co.uk v --------------------------------------------

« previous php.general (#100396) next »