Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75670 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84880 invoked from network); 17 Jul 2014 13:31:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 13:31:53 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:36374] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/10-18859-740D7C35 for ; Thu, 17 Jul 2014 09:31:51 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 6D88B2400D0; Thu, 17 Jul 2014 09:31:47 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NkZHCAKtA3pV; Thu, 17 Jul 2014 09:31:47 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 738632400C2; Thu, 17 Jul 2014 09:31:45 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 17 Jul 2014 14:31:42 +0100 Cc: Sara Golemon , bishop@php.net, PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <37F89E54-C5B9-4E81-9D1B-660190BDB1FF@ajf.me> To: Nikita Popov X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] intdiv() From: ajf@ajf.me (Andrea Faulds) On 17 Jul 2014, at 10:24, Nikita Popov wrote: > This is already what is currently happening, see > http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_operators.c#1067. >=20 > 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=92s 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=92t mean = you shouldn=92t have a right shift. -- Andrea Faulds http://ajf.me/