Re: [RFC] intdiv()

From: Date: Thu, 17 Jul 2014 06:56:19 +0000
Subject: Re: [RFC] intdiv()
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-75648@lists.php.net to get a copy of this message
Hi Andrea, On Thu, Jul 17, 2014 at 8:44 AM, Andrea Faulds <ajf@ajf.me> wrote: > > On 17 Jul 2014, at 07:29, Zeev Suraski <zeev@zend.com> wrote: > >> From debating whether it's worth it to add a new function for an >> not-so-commonly-used-operation-to-say-the-least, we're now seriously >> considering adding a new language level operator? Really? > > Is it *really* not that common? I can think of several use-cases off the top of my head: > > * Time (actually pretty common in web apps, though we have a DateTime class) > * Splitting into rows and columns > * Pagination > * Currency (you can’t, for example, represent the full number of BTC in circulation in > BTC's base unit without using an integer of beyond 53-bits, and it’s common practise to use > *fixed-point* arithmetic here) > * Nearest-neighbour scaling > * Most likely other ones (these are just what I thought of immediately) > > Also, while ** is great for some applications, it’s not going to be used much by others. Is > the same not true of an integer division operator? The rare cases where I had to do that, I relied on bcmath or gmp. Yes, I needed some extra ops to actually achieve what this RFC proposes but it is good enough. The new ops overloading for extension simplifies that a lot as well. I am sorry but I'd to say -1 on this addition, not worse a new operator or function for this. Cheers, -- Pierre @pierrejoye | http://www.libgd.org

« previous php.internals (#75648) next »