Re: [RFC] intdiv()

From: Date: Thu, 17 Jul 2014 13:31:42 +0000
Subject: Re: [RFC] intdiv()
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-75670@lists.php.net to get a copy of this message
On 17 Jul 2014, at 10:24, Nikita Popov <nikita.ppv@gmail.com> wrote: > This is already what is currently happening, see > http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_operators.c#1067. > > Andreas proposal is only useful in the case that the numbers don't divide > exactly and you need round-down/truncation behavior and your numbers are in > a range where the indirection through double arithmetic results in > precision loss. It’s still useful regardless as it saves you implementing it in terms of floats. I mean, you can implement a right shift (rarely used outside bit masks) in terms of multiplication and exponentiation, but that doesn’t mean you shouldn’t have a right shift. -- Andrea Faulds http://ajf.me/

« previous php.internals (#75670) next »