Excellent idea. bcmath is already not the highest performance thing in the world, so adding a function that parses a more reasonable looking expression would not be an unacceptable compromise for most.
It also doesn't give you the false impression that since operators do the right thing functions are going to do the right thing too. That's very muddy and confusing. On Tue, Mar 6, 2012 at 5:12 PM, Daniel Macedo <admac...@gmail.com> wrote: > On Tue, Mar 6, 2012 at 22:05, Michael Morris <dmgx.mich...@gmail.com> wrote: >> 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. > > I agree with you, how about having the bcmath extension support a more > general (and even better, non-BC-breaking) function supporting the > order of math operations (and maybe even math functions)... Something > like a bc(string $operations [, int $scale = 2]) > > Supporting passing: bc("(29.99 + $a) * $b - pow(10, $c) / 2"); > > Came across something like that in the manual: http://php.net/ref.bc#107014 > How's that for a quick 'n dirty idea to solve this issue? > > ~ Daniel Macedo > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php