Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40248 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30655 invoked from network); 4 Sep 2008 11:39:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2008 11:39:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:57400] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/B2-15517-AF8CFB84 for ; Thu, 04 Sep 2008 07:39:39 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id E75925C42; Thu, 4 Sep 2008 07:39:35 -0400 (EDT) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v4ncIYCZBf+g; Thu, 4 Sep 2008 07:39:35 -0400 (EDT) Received: from jbondc (modemcable158.97-203-24.mc.videotron.ca [24.203.97.158]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 1CF845C3D; Thu, 4 Sep 2008 07:39:35 -0400 (EDT) To: "'Christian Seiler'" , "'php-dev List'" References: <48B07A62.3050207@gmx.net> <48B6E49E.3020409@gmx.net> In-Reply-To: <48B6E49E.3020409@gmx.net> Date: Thu, 4 Sep 2008 07:39:34 -0400 Message-ID: <000001c90e82$e7b1b410$b7151c30$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AckJPDPjjPsy6TKoQNydu4Rs9Osc5gFQ07hA Content-Language: en-ca Subject: RE: [PHP-DEV] [RFC] [PATCH] Rounding in PHP From: jbondc@openmv.com ("Jonathan Bond-Caron") On Thu Aug 28 01:47 PM, Christian Seiler wrote: > Hi again, >=20 >> A few weeks ago I wrote quite a long posting to internals@ that tried = >> to clarify the situation on the round() function in PHP. I was asked=20 >> to write it up as an RFC in the wiki, which I have done: >>=20 >> http://wiki.php.net/rfc/rounding >=20 > Since there has been no reaction so far to my proposal (besides the=20 > help from Hannes and Pierre for the Win32 build dependencies, thanks=20 > for that btw.), I'd like to know why? Am I talking gibberish and my=20 > proposal is hard to understand? Or have I simply chosen a topic that=20 > many do not consider worthwhile investing that amount of energy into? > Or is it something else? For the record, I was very excited to see your proposal and the work = you've done.=20 I'm not a PHP dev so I can't comment on the patch, maybe there might be = a performance concern? I don't know either the history of the 'rounding fuzz', but there's = definitely space for improvement... The problem naturally isn't with = floats but that the round() function is very misleading. My opinion is = the rounding precision should be removed or fixed since it doesn't work = "as expected". i.e. javascript, there's no precision: Math.round() " Nevertheless, what could be discussed separately is the introduction of = a new type that automatically uses an arbitrary precision library = internally, since writing $a * $b is much more natural than e.g. = bcmul($a, $b). This, however, goes far beyond the scope of this = proposal. " I'm all for this... maybe something like this: // within some 'numeric' precision $a =3D (numeric)2; $b =3D (numeric)0.5; $mult =3D $a * $b; echo $mult;// 1 (numeric) echo (2.5 =3D=3D $a + $b); // true=20 echo (2.5 =3D=3D=3D $a + $b); // false echo ((numeric)2.5 =3D=3D=3D $a + $b); // true