Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24981 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59777 invoked by uid 1010); 26 Jul 2006 09:27:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 59757 invoked from network); 26 Jul 2006 09:27:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2006 09:27:06 -0000 X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.142.136.132 msa2-mx.centurytel.net Linux 2.4/2.6 Received: from ([209.142.136.132:37402] helo=msa2-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 48/B6-04178-F5537C44 for ; Wed, 26 Jul 2006 05:26:58 -0400 Received: from pc1 (72-161-141-158.dyn.centurytel.net [72.161.141.158]) by msa2-mx.centurytel.net (8.13.6/8.13.6) with SMTP id k6Q9QqXV023071 for ; Wed, 26 Jul 2006 04:26:52 -0500 Message-ID: <00c601c6b095$a1a2e220$0201a8c0@pc1> To: Date: Wed, 26 Jul 2006 04:26:53 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Subject: dec*(), *dec(), base_convert() and negative numbers From: php_lists@realplain.com ("Matt W") Hi all, I was just updating the dec[bin|hex|oct] functions to convert numbers >= 2^32 since the [bin|hex|oct]dec counterparts were updated way back in PHP 4.1. My question is if negative numbers should be handled any differently. Now negative longs are converted to unsigned which gives a weird result for regular users IMO. The *dec() functions ignore negative strings. Because of the way base_convert() works, if you pass a negative number (gets converted to string), the result will be from the absolute value instead of what you get with dec*(). *) Should the dec*() functions continue to convert negative longs to unsigned and use absolute value for doubles? *) Should absolute value always be used, like with base_convert()? *) Should everything be changed to support negative numbers going both directions (to or from base)? Thanks, Matt