Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58687 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74365 invoked from network); 6 Mar 2012 21:31:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2012 21:31:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:61725] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/8E-32184-332865F4 for ; Tue, 06 Mar 2012 16:31:32 -0500 Received: by qcmt36 with SMTP id t36so3235259qcm.29 for ; Tue, 06 Mar 2012 13:31:29 -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 :cc:content-type:content-transfer-encoding; bh=aMTDuNDltc9gjnvb30o4yRbF9gaJrcS18Eyk2g71cuk=; b=CUTPBQ352WCqzy6jCn03+D+ZGRyC4H/UPeCkcYvo+hPZVXl1aVnKlPgTAe+23Nb0Em DaPQTurFJY+YCIJYThRV6QhoqLKje3tN6dn/gi6sQrhHbdo0pE8hj3Vu1YngBe6uv4W+ DUdcLVY5sALAaMuafccogdBSEhE9ADOM3+3F2d1vlzXvP/i/nUdsL0lChJjtodaAiXYH pvvK8XecMpP1Zwc569rtBF255R1TMrsLEQYn7aKRnaehaxbYPbbREja/bSE1VwtZMGoI iFM/cyLRgyipDuuq6RriUIfF3xE5PicVasFXmdSjHOJfcPy2vP0EStXm37Hj8F/OkoL7 JvGg== MIME-Version: 1.0 Received: by 10.224.32.12 with SMTP id a12mr48977qad.66.1331069489059; Tue, 06 Mar 2012 13:31:29 -0800 (PST) Received: by 10.229.49.74 with HTTP; Tue, 6 Mar 2012 13:31:29 -0800 (PST) In-Reply-To: References: Date: Tue, 6 Mar 2012 16:31:29 -0500 Message-ID: To: Michael Morris Cc: 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: ircmaxell@gmail.com (Anthony Ferrara) >> 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. =A0Math functions like pow would not be > affected. Actually, I see that as even worse. Why would 2 * 4 be possible to be different from pow(2, 3)? That doesn't really make sense (to me). I think if it was added, all of the math related extensions would need to be (should be) updated as suits. Otherwise it's just another random inconsistency... >> >> 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. =A0Also, for scripts where the author wasn't > aware of the peril of floating point math the setting could actually > fix their existing code. When I said BC break, I'm talking about at the engine level. So all 3pd code that hooks into the engine (PECL extensions mainly) would be broken, as the structure of the ZVal would need to change to accommodate the bignum representation...