Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75620 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72635 invoked from network); 17 Jul 2014 00:11:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 00:11:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.173 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 209.85.217.173 mail-lb0-f173.google.com Received: from [209.85.217.173] ([209.85.217.173:39636] helo=mail-lb0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/A6-37298-9B417C35 for ; Wed, 16 Jul 2014 20:11:38 -0400 Received: by mail-lb0-f173.google.com with SMTP id n15so1168063lbi.4 for ; Wed, 16 Jul 2014 17:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=AiAqkzvxbqQdlMfY7Fruhe5QPIpY9CP2laPo5K8uE0c=; b=PFqZtCjAYB1XeSnEs9WFpYEONWV1U2fCs3T2u81MnrSbRzOecZg66fnlWhgxeiySzD eVd/INXeMSiRt7/ZBTmMecRajmW3EHT0sz4jsSoX2ZWe+8sQgZ5FTL84FiAEkeHCAChv ENEA5kQsK7RaeYXlKWpbDV9vSZRDJxZIQAN3kExQ4m5YKmTts0IPckFoBriXpbm4aGWG fnZfK7LfjYA8E/1ZX29l+Uu1kTq6i0PsZXCHEIRX0s7F7S4/fsKui0POLDR0lAPOjn79 Anmta+hadPhRafdGxUsB7MoxhBmpiU/no/c+UtKgqqnhD2ooqXwCilfjaY42Zlxa2+az c+zg== MIME-Version: 1.0 X-Received: by 10.112.161.201 with SMTP id xu9mr15993436lbb.59.1405555894102; Wed, 16 Jul 2014 17:11:34 -0700 (PDT) Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.152.242.34 with HTTP; Wed, 16 Jul 2014 17:11:33 -0700 (PDT) Received: by 10.152.242.34 with HTTP; Wed, 16 Jul 2014 17:11:33 -0700 (PDT) In-Reply-To: References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <37F89E54-C5B9-4E81-9D1B-660190BDB1FF@ajf.me> Date: Wed, 16 Jul 2014 20:11:33 -0400 X-Google-Sender-Auth: JMRWxsP-YmXJNHFedoUP-DmHP5Y Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c31d3cc7b00504fe587b43 Subject: Re: [PHP-DEV] [RFC] intdiv() From: bishop@php.net (Bishop Bettini) --001a11c31d3cc7b00504fe587b43 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable As another contender, how about: $x =3D 242 %/ 7; $x %/=3D 13; The % reflects the relationship to modulus, while the / reflects the division effect. I think %/ looks worse, but I think it seems more apropos= . On Jul 16, 2014 11:15 AM, "Andrea Faulds" wrote: On 16 Jul 2014, at 02:51, Bishop Bettini wrote: > TL;DR -- I agree with the principal but want implemented as the infix > operator %% with a test for PHP_INT_MIN %% -1 =3D=3D=3D false (and a E_WA= RNING). The RFC has been updated to v0.2. It now proposes a %% operator for integer division (with corresponding %%=3D assignment operator). However, it return= s 0 for the PHP_INT_MIN overflow case like %, rather than FALSE and an E_WARNING. The original intdiv() proposal is kept as a fallback; two votes will be held simultaneously, one 2/3 vote for the %% operator and a 50%+1 for the intdiv() function. If the first fails, then if the second did not, the intdiv() function is implemented instead. This way we=E2=80=99ll still at l= east have a way to do integer division in PHP, if not a full operator. Nikita Popov doesn=E2=80=99t seem to be a fan of the %% syntax, so it may b= e subject to change, though I think it=E2=80=99s the best I=E2=80=99ve heard = so far. ;) -- Andrea Faulds http://ajf.me/ --001a11c31d3cc7b00504fe587b43--