Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75657 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47423 invoked from network); 17 Jul 2014 07:42:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 07:42:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:42495] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/D7-09067-C4E77C35 for ; Thu, 17 Jul 2014 03:42:05 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 535048800DB; Thu, 17 Jul 2014 03:42:01 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lt6KVX_ujgu6; Thu, 17 Jul 2014 03:42:01 -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 1F60A8800CB; Thu, 17 Jul 2014 03:41:58 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <53C7789F.40000@sugarcrm.com> Date: Thu, 17 Jul 2014 08:41:55 +0100 Cc: Zeev Suraski , "bishop@php.net" , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <9C4EFD88-2BD4-445A-A573-E818DC9F55CC@ajf.me> References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <37F89E54-C5B9-4E81-9D1B-660190BDB1FF@ajf.me> <9F08728B-AF74-4098-8D1D-BC21AB821168@ajf.me> <53C7789F.40000@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] intdiv() From: ajf@ajf.me (Andrea Faulds) On 17 Jul 2014, at 08:17, Stas Malyshev wrote: > Hi! >=20 >> * Time (actually pretty common in web apps, though we have a DateTime >> class) >=20 > Admittedly, we're getting closer to the dreaded year 2038, but what = does > it actually mean to divide current Unix timestamp by 3 and why one = would > ever want to do this? We also have classes for real datetime = calculations. To divide by three is probably a bad example, but it=92s fair to point = out that anything with UNIX timestamps would work fine with just floats = as we don=92t need 53 bits yet. > Here you are onto something, but how often you paginate data sets of > MAXINT size and need exact number of pages? Rarely, I suspect, but it would still be nice to have a proper way of = doing the division > If you're using ints for currency, you're probably doing it wrong. If > you're dividing currency using integer division, I don't even know = what > you are trying to do, except reenacting Office Space :) A lot of people use ints as a poor man=92s fixnum, and sometimes that=92s = actually the right way to implement them. IIRC, Bitcoin is implemented = using 64-bit integers internally. > You mean image processing? If 53 bit precision is not enough there, = I'm > not even sure PHP should be doing that. True, but again, you should still ask why PHP doesn=92t support integer = division in the first place. > IMHO this is not enough for a new operator... Especially if this means > we have to tolerate something like %/. %/ and %% are hardly the nicest operators, no. Myself I like %% as % = being one part and %% being the other part of an integer division makes = sense to me, but I can see why others might not like it. -- Andrea Faulds http://ajf.me/