Re: [RFC] Config setting to force all math operations to pass through BCMath library.

From: Date: Tue, 06 Mar 2012 22:05:02 +0000
Subject: Re: [RFC] Config setting to force all math operations to pass through BCMath library.
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-58694@lists.php.net to get a copy of this message
On Tue, Mar 6, 2012 at 4:47 PM, Tomas Kuliavas <tokul@users.sourceforge.net> wrote: > 2012.03.06 23:03 Michael Morris rašė: >> 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.

« previous php.internals (#58694) next »