Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76726 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86004 invoked from network); 20 Aug 2014 10:05:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2014 10:05:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.173 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.173 mail-vc0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:34785] helo=mail-vc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/D1-11231-DF274F35 for ; Wed, 20 Aug 2014 06:05:49 -0400 Received: by mail-vc0-f173.google.com with SMTP id hy10so8872757vcb.18 for ; Wed, 20 Aug 2014 03:05:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=OQBkWl/laxG7cNCk6PZY7lCh3YOT0IhI73LZ+DoWHDA=; b=KTKBM6GYLRTf6DgXUAG0GRUsEZIzHzft8R60EmU+RhVqNLLehmBmxR/wnlT8vBaR9j f0c9F/+0KupkSitkZ69a5wZZM9OkxSijcyehWF9CaVkm8tjOPttbMAgs9HwdtJDaQMbC /flxQqL2oDI8obe6gn/XCb7M5XQkAkINJJTdF10Ns5Kz6uZJRkm0FYMxyrs0rTRYqTFw 3xKAuq8HCBNpfXoOEqKDDMxtPCJzWTaRaMfGr+xHdnJg6mEsq9yFD7EwjDvxl7XujaYY 49LfwFx+RJ45nx5lby+RMAiqdcQJc9vdx9GgkL5d2+iecB1Js35ydzWgGB4i1iJWh/ie NohQ== X-Gm-Message-State: ALoCoQk6T5nD0hdl4+Di3J96Iw+hBHfqhrqWfQ+NbvfnHrgob4BqF03K+q6I6N9ICZxkNm2Ry+DYE6mOC6zJ19i29u6ZQ3gher/dlNDS0wpxqxEVIh399hZB5ncsy1q3R8ahVSXDBEGB MIME-Version: 1.0 X-Received: by 10.52.8.71 with SMTP id p7mr245780vda.77.1408529146670; Wed, 20 Aug 2014 03:05:46 -0700 (PDT) Received: by 10.52.110.170 with HTTP; Wed, 20 Aug 2014 03:05:46 -0700 (PDT) In-Reply-To: <4FAA8D1B-DFD5-4013-8407-F9E16AEAD5E2@ajf.me> References: <88F3B0AF-786C-43BA-AD39-3D8B77D13B2F@ajf.me> <4FAA8D1B-DFD5-4013-8407-F9E16AEAD5E2@ajf.me> Date: Wed, 20 Aug 2014 14:05:46 +0400 Message-ID: To: Andrea Faulds Cc: Sara Golemon , PHP Internals Content-Type: multipart/alternative; boundary=20cf3033473571871e05010cbfb2 Subject: Re: [PHP-DEV] [RFC] Integer Semantics From: dmitry@zend.com (Dmitry Stogov) --20cf3033473571871e05010cbfb2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Aug 20, 2014 at 1:20 PM, Andrea Faulds wrote: > > On 20 Aug 2014, at 06:52, Dmitry Stogov wrote: > > > 1) INF conversion to zero seems wrong. May be +INF should be converted > to MAX_LONG and -INF to MIN_LONG? > > I think of Infinity as more of an error value than an actual number. Not > using MAX_LONG and MIN_LONG means it casts to the same value matter how > large the integer type is, and it happens to be what JavaScript casts > Infinity to. There=E2=80=99s also the fringe benefit that 1/0=E2=80=99s r= esult in PHP, > FALSE, casts to zero, as Infinity now would also, which is the standard > IEEE 754 result for 1/0. > > > 3) a bit unrelated, but it also may make sense to introduce a logical > right shift operator (>>> in Java) > The difference between "arithmetic" and "logical" shift is sign propagation= . 0x10000000 >> 1 =3D=3D 0x11000000 0x10000000 >>> 1 =3D=3D 0x01000000 In C the same >> operator perform "arithmetic" shift for signed numbers and "logical" shift for unsigned. Thanks. Dmitry. > > How would that function? > -- > Andrea Faulds > http://ajf.me/ > > > > > --20cf3033473571871e05010cbfb2--