Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58694 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84673 invoked from network); 6 Mar 2012 22:05:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2012 22:05:07 -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 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:61131] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/E0-15021-11A865F4 for ; Tue, 06 Mar 2012 17:05:06 -0500 Received: by wibhj13 with SMTP id hj13so2866695wib.29 for ; Tue, 06 Mar 2012 14:05:02 -0800 (PST) Received-SPF: pass (google.com: domain of dmgx.michael@gmail.com designates 10.180.93.4 as permitted sender) client-ip=10.180.93.4; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dmgx.michael@gmail.com designates 10.180.93.4 as permitted sender) smtp.mail=dmgx.michael@gmail.com; dkim=pass header.i=dmgx.michael@gmail.com Received: from mr.google.com ([10.180.93.4]) by 10.180.93.4 with SMTP id cq4mr27333595wib.21.1331071502696 (num_hops = 1); Tue, 06 Mar 2012 14:05:02 -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=O8QtcD0ZLI3dOhjhkgZqQTjwKJu/jkxO3Kab2HhnfjA=; b=uLiLsKFDDePoF6s7DK8mvomv7Q0RsaD/jz0E1VX+8inXXvgvL8RYtO6ZM7K12pwytc +F5CqvBcNVKXMXPXcB2NY5+Cdr3xBqxPDfMYARpdT0Gjzya723RnPkoKCsJoJL2nZP1E 9ckesnYvBoN2yPXsRnxfiJY13IPJGxEO52VhbAuE9mP5KEs9dl+IPqfzThrpKLGGfWuF opRM29kaZU7qfisTXHF/751u/DK1R4QQS8sMbsclRacba004HvW9+Xz0udNx4k9x7H/W o9bOvabPYnUzdmAr+iVJ+IU/2GLFluMSOq5ArrE8Xc1ZfAtXNZx39gyuJH93y1X/saJH YoRA== MIME-Version: 1.0 Received: by 10.180.93.4 with SMTP id cq4mr21606446wib.21.1331071502532; Tue, 06 Mar 2012 14:05:02 -0800 (PST) Received: by 10.216.51.68 with HTTP; Tue, 6 Mar 2012 14:05:02 -0800 (PST) In-Reply-To: <59884.5975f635.1331070466.nsm@avilys.eik.lt> References: <59884.5975f635.1331070466.nsm@avilys.eik.lt> Date: Tue, 6 Mar 2012 17:05:02 -0500 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 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:47 PM, Tomas Kuliavas wrote: > 2012.03.06 23:03 Michael Morris ra=C5=A1=C4=97: >> https://wiki.php.net/rfc/php_ini_bcmath_default >> >> This is the only other RFC I've been rummaging around in my head but >> hadn't brought up. > > PHP has something similar with mbstring function overloading. If people > use both string and mbstring functions, they can no longer trust string > functions. mbstring function overloading makes string functions > unreliable. Functions, that are not charset aware by default, can start > operating in different charset with a single flip in interpreter config. > First you start cursing, then you have to implement workarounds to deal > with features designed for people, who want to use different functions > without changing a single line in their code. You are asking to do same > thing in math functions. No, I am not. This RFC involves the operators, not the functions. Addition, division, multiplication, subtraction. The PHP math functions will behave as they always have. > > If you want to use bcmath, use bcmath in your code. I do use it. It's a pain in the ass to read because you have to LISP nest all the operations. You can't tell me this is easy or intuitive to read... bcadd( bcsub( $bill['penalty'], $bill['rounding'], 2),bcmul( $bill['taxdue'], bcmul( $penalty, $monthsAhead, 2 ), 2 ), 2 ) Compared to $bill['penalty'] - $bill['rounding'] + $bill['taxdue'] * $penalty * $monthsAhead; You can do it, but it's eye bleeding.