Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58685 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70568 invoked from network); 6 Mar 2012 21:22:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2012 21:22:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:44935] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/AD-32184-400865F4 for ; Tue, 06 Mar 2012 16:22:13 -0500 Received: by werh12 with SMTP id h12so4019861wer.29 for ; Tue, 06 Mar 2012 13:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of dmgx.michael@gmail.com designates 10.216.137.163 as permitted sender) client-ip=10.216.137.163; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dmgx.michael@gmail.com designates 10.216.137.163 as permitted sender) smtp.mail=dmgx.michael@gmail.com; dkim=pass header.i=dmgx.michael@gmail.com Received: from mr.google.com ([10.216.137.163]) by 10.216.137.163 with SMTP id y35mr8956758wei.33.1331068929711 (num_hops = 1); Tue, 06 Mar 2012 13:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=O3AaSzUIIAuvB3oH2Uq++hkBO/rCENZe21qfCAACPXE=; b=x7Q6Cg1WwmbVDSQLeW4f5bBtwzF7RqIG2v72NPpQ4HilQ7uGGGXV7XlaXDhUwDnVAZ IAtpxWZKsrYVX3jbA87f/tpEq6S30Cy7eMPRQ20xOXC8O18KbMmd4hYRmaU5ZG0YZ1ak AtoupVfCpXfXfU3p4ImcGpVMpaI62Z0kaizxmaMNjhLpu2q1HvWb02hH1xm5m/q4I0KU ojelMu05l4cet50sRi/KSFX3qHWzeekwDiG9WWai4BJqUurSAHzTZwXC2UjQPrUpCrRU 7e37AtfsXfK5NdScc2by5sMjCEPYiQx+cWR8+qX0MZTe3vvuRgU8uoHuhwY2t67QKOqc 4dlw== MIME-Version: 1.0 Received: by 10.216.137.163 with SMTP id y35mr7166742wei.33.1331068929565; Tue, 06 Mar 2012 13:22:09 -0800 (PST) Received: by 10.216.51.68 with HTTP; Tue, 6 Mar 2012 13:22:09 -0800 (PST) In-Reply-To: References: Date: Tue, 6 Mar 2012 16:22:09 -0500 Message-ID: To: PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Config setting to force all math operations to pass through BCMath library. From: dmgx.michael@gmail.com (Michael Morris) On Tue, Mar 6, 2012 at 4:18 PM, Anthony Ferrara wrote= : > I initially like the concept (arbitrary precision operations). > > But please don't add another ini setting. =A0Especially one where > *logic* can change depending on the setting. =A0I don't want a case > where pow(2, 65)-1 will return different answers depending on the ini. > =A0That's just asking for problems. I edited the RFC while you were sending this for clarification. This setting would only affect the math operators (+,/,*,-) mapping them to their bcmath equivalents. Math functions like pow would not be affected. > > Instead, perhaps a pythonic approach may be useful (storing as > int/float for small values, but auto-converting to arbitrary precision > if the int/float can't exactly represent what was > requested/computed)... =A0Just a thought to make it useful without the > ini complexity or performance hits. > > Although this will present a significant BC break (internally, zend > engine wise), so it would probably be limited to a major release > anyway... > With a setting there would be no BC break since, if you turn it on, presumably you want it on. Also, for scripts where the author wasn't aware of the peril of floating point math the setting could actually fix their existing code.