Re: [RFC] intdiv()

From: Date: Tue, 15 Jul 2014 12:20:12 +0000
Subject: Re: [RFC] intdiv()
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-75537@lists.php.net to get a copy of this message
On 15 Jul 2014, at 06:17, Stas Malyshev <smalyshev@sugarcrm.com> wrote: > Why not? bcmath is in core since forever and has no external > requirements, gmp builds practically everywhere too. AFAIR all distros > have it. Partly practicality, partly principle. A barebones installation of PHP may not include gmp or bcmath. If my bigint RFC got in, it would have to include the former, but that is a possible future and not the present reality. I should point out that while, yes, bcmath could be used here, it is not efficient to do it by string manipulation (this is a type *natively supported* by literally every semi-modern processor and an operation built into C!). Also, gmp does the wrong thing, as will give you a gmp number result, whereas what I want is an integer. To use gmp is just as hackish as doing a floating-point division and casting, as the values we pass in would be converted to big integers, divided, then the resulting big integer would need to be manually converted back to a long. It would make far more sense to simply support this basic, widely-supported and somewhat common operation than to encourage programmers to use poor workarounds which do not even work when a basic PHP installation is used. -- Andrea Faulds http://ajf.me/

« previous php.internals (#75537) next »