Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76323 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63294 invoked from network); 3 Aug 2014 14:31:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2014 14:31:13 -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:44398] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 80/E3-25844-FA74ED35 for ; Sun, 03 Aug 2014 10:31:13 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 2EE98886B18; Sun, 3 Aug 2014 10:31:33 -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 IMxnm8E8fUsf; Sun, 3 Aug 2014 10:31:33 -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 1C409886AD4; Sun, 3 Aug 2014 10:31:31 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <53DE46E4.5060309@lsces.co.uk> Date: Sun, 3 Aug 2014 15:31:28 +0100 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <18236437-5EEA-4F85-8346-E89D6D5692B1@ajf.me> References: <739E5BAE-A01D-4936-A016-8CD90CD64BA1@ajf.me> <218DB0E9-B785-4E86-A74C-A59B428DB037@ajf.me> <53DE29F3.7030101@lsces.co.uk> <53DE46E4.5060309@lsces.co.uk> To: Lester Caine X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [VOTE][RFC] intdiv() From: ajf@ajf.me (Andrea Faulds) On 3 Aug 2014, at 15:27, Lester Caine wrote: > Your missing the point I was trying to make. That "(int)(3 / 2)" > essentially goes wrong only on 64bit systems is the bug that needs > fixing. (int)(3 / 2) works fine, (int)(PHP_INT_MAX / 3) does not. It=92s not a bug, it=92s entirely intentional and expected behaviour. = You=92re doing a floating-point division then casting to integer, which = will sometimes lead to a loss of precision. And no, having a division wrapped in (int) work differently from a = normal division isn=92t a good idea. That means the operator acts = differently based on context. It would mean $a =3D PHP_INT_MAX / 3; $a =3D= (int)$a; would do something entirely different from $a =3D = (int)(PHP_INT_MAX / 3); -- Andrea Faulds http://ajf.me/