Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25008 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97781 invoked by uid 1010); 27 Jul 2006 13:43:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 97765 invoked from network); 27 Jul 2006 13:43:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jul 2006 13:43:09 -0000 X-Host-Fingerprint: 80.123.98.46 unknown Received: from ([80.123.98.46:19247] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 19/E0-23194-CE2C8C44 for ; Thu, 27 Jul 2006 09:43:09 -0400 Message-ID: <19.E0.23194.CE2C8C44@pb1.pair.com> To: internals@lists.php.net Date: Thu, 27 Jul 2006 15:43:27 +0200 User-Agent: Thunderbird 1.5.0.4 (X11/20060615) MIME-Version: 1.0 References: <00c601c6b095$a1a2e220$0201a8c0@pc1> <010601c6b169$225b9eb0$0201a8c0@pc1> <6E.DD.23194.071B8C44@pb1.pair.com> <016401c6b17e$027908c0$0201a8c0@pc1> In-Reply-To: <016401c6b17e$027908c0$0201a8c0@pc1> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Posted-By: 80.123.98.46 Subject: Re: [PHP-DEV] dec*(), *dec(), base_convert() and negative numbers From: mike@php.net (Michael Wallner) Matt W wrote: > That's why I'm assuming negative numbers aren't "really" supported > now (not in any form with base_convert()), but it's simply a side > effect of wanting to handle *positive* numbers between LONG_MAX and > ULONG_MAX. e.g. when doing dechex(4294967173) that's a PHP double, > but it gets converted to long (becomes -123), and finally unsigned > long (recovering 4294967173). IOW, after convert_to_long() in dec*() > it doesn't know if -123 or 4294967173 was passed. Make sense? > (Actually, it doesn't, that's my point. :-)) For your computer 0xffffff85 is -123 and 4294967173. It's just how you look on it. > So after more thinking, I figure when upgrading dec*() to handle any > number, absolute value should be used (then int(123) would be > returned in my example). Unless the all the functions are changed to > properly accept/return negatives... I personally don't care either > way on that. No way. Why should hexdec(dechex(-123)) return +123? -- Michael