Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85952 invoked by uid 1010); 10 Oct 2007 17:40:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85937 invoked from network); 10 Oct 2007 17:40:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2007 17:40:04 -0000 Authentication-Results: pb1.pair.com header.from=rrichards@ctindustries.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rrichards@ctindustries.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ctindustries.net from 216.117.147.250 cause and error) X-PHP-List-Original-Sender: rrichards@ctindustries.net X-Host-Fingerprint: 216.117.147.250 unknown Received: from [216.117.147.250] ([216.117.147.250:40953] helo=ctindustries.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/F3-55062-E6E0D074 for ; Wed, 10 Oct 2007 13:40:00 -0400 Received: from localhost.localdomain (da001d1779.cam-ma.osd.concentric.net [64.0.238.243]) (authenticated bits=0) by ctindustries.net (8.13.8/8.13.8) with ESMTP id l9AHXa9K021468 for ; Wed, 10 Oct 2007 13:33:37 -0400 Message-ID: <470D0DD8.7080100@ctindustries.net> Date: Wed, 10 Oct 2007 13:37:28 -0400 User-Agent: Thunderbird 2.0.0.6 (X11/20070811) MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/4521/Wed Oct 10 03:58:01 2007 on ctindustries.net X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=4.4 tests=none autolearn=disabled version=3.1.9 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on ctindustries.net Subject: Object arithmetic From: rrichards@ctindustries.net (Rob Richards) I was wondering why objects are always converted to longs when performing arithmetic. While looking at bug 42780: http://bugs.php.net/bug.php?id=42780 The only way not to lose precision is to explicitly cast the object to float or string, which just doesn't seem right to me. It would be nice if there was an object handler like to_numeric where an object could determine what type of numeric to return, or some other way for this to happen. This would then allow it to work like performing math on strings. When is_numeric string is called, it is properly to converted to either a double or long so precision is not lost. Rob