Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Michael Selik Newsgroups: comp.lang.python Subject: Re: Is signed zero always available? Date: Thu, 23 Jun 2016 00:34:51 +0000 Lines: 40 Message-ID: References: <576a925f$0$1597$c3e8da3$5496439d@news.astraweb.com> <1466606088.4117582.645299713.03DA7658@webmail.messagingengine.com> <285A7071-5102-4516-BD3E-79C291023705@icloud.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de N16LfeYTl43uvxMq/lLB3QAenErRi16V9JsIuiwIgwNA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'compiler': 0.05; 'used.': 0.05; 'cc:addr:python-list': 0.09; '22,': 0.09; 'integers': 0.09; 'minus': 0.09; 'reliably': 0.09; 'zero.': 0.09; 'python': 0.10; 'wed,': 0.15; '>>>': 0.15; 'mathematics': 0.15; '-0.': 0.16; '2016': 0.16; 'assembly,': 0.16; 'distinction': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'trap': 0.16; 'true:': 0.16; 'wrote:': 0.16; 'detect': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'to:2**1': 0.21; 'pascal': 0.22; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'header :In-Reply-To:1': 0.24; 'discussion': 0.24; 'signed': 0.24; 'supported': 0.27; 'define': 0.27; 'not.': 0.27; 'message- id:@mail.gmail.com': 0.27; 'that.': 0.30; 'probably': 0.31; "can't": 0.32; 'int': 0.33; 'received:google.com': 0.35; 'so,': 0.35; 'instance': 0.35; 'something': 0.35; 'there': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'available.': 0.37; 'thought': 0.37; 'seem': 0.37; 'version': 0.38; 'received:209': 0.38; 'received:209.85.220': 0.38; 'where': 0.40; 'ever': 0.60; 'back': 0.62; 'guaranteed': 0.67; 'approaches': 0.72; 'gotten': 0.76; 'miss': 0.77; 'subject:available': 0.79; 'college,': 0.84; 'concept.': 0.84; 'subject:always': 0.84; 'edwards': 0.91; 'instructors': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/2TMs3KkAUtIW+ubtWU+QDvnmymSnD4WqD5OssWNM/Q=; b=Rq/xfcG9ItCK4Cz5F+5gaYx9iYL5jEz224uoVbnJwH/J0sx2F+U17x//DzJOAq5DGI rXqei1nqyPhclvdNMIyFEsYnb3mIEYM3XZPLhxQXx74eBbJBnxYfGTsZfVJw0iN9AFFr q8F8l6H6ElOPfzlApldKBTfZHBWvxAqDhiNVlaVKyIVcIMmUzB+XCnpm1gIFk4QzvdI9 d7hA6Fwo5wfyHLqZHOzI7CClUDMfpEpBZqE2gVqNugBbkgBC9jmOQvZEZuSIHmYl67lM +pIoVxOC7utGsreyDxmPL4RTkFIYTml2o90kO9gnRlJTGVSeWErV1aeGBGvPFE+uIdWS kAww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/2TMs3KkAUtIW+ubtWU+QDvnmymSnD4WqD5OssWNM/Q=; b=eAP4DJe5xlyhVtn27p7BCYGKSV7H4zO0cysIm0KHlVUQh3sIHc0RExsyLtCBKfydEL LccgiuIAIbF3SJUXcL+o49g4VdyrgfE23o7mZdtXQW1/IhNOI5MJC4P3wMnt6l6JRF4N Gzoh1bbByhqWRhuo92gRRBjHNg1S1wU7USmT3Pw86RTqUggFPss/qjyn4tAdJMvANw/b Yw88WB2+jtq9Ne0nnTWnBH5pRv2V5g4n4WybcKbCcTkSuVpBcdC/vJ9466JqQWh5F6RV XjTthilf7FXFa3zCqmN62/VtedG5jd1hoKliXmL2adL/VowAT1OpuUdeQWUGgrSTwr9U +hUA== X-Gm-Message-State: ALyK8tJ1yVZ342lNxGtlgAG6SILum9ygpt4CDr0OTmddoT3sIk0H3xsYPsUYzHEwk2xKfJ6ZY6FZ00g8woAtVA== X-Received: by 10.237.39.167 with SMTP id a36mr26426566qtd.103.1466642101252; Wed, 22 Jun 2016 17:35:01 -0700 (PDT) In-Reply-To: <285A7071-5102-4516-BD3E-79C291023705@icloud.com> X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <576a925f$0$1597$c3e8da3$5496439d@news.astraweb.com> <1466606088.4117582.645299713.03DA7658@webmail.messagingengine.com> <285A7071-5102-4516-BD3E-79C291023705@icloud.com> Xref: csiph.com comp.lang.python:110347 On Wed, Jun 22, 2016 at 4:53 PM Christopher Reimer < christopher_reimer@icloud.com> wrote: > > On Jun 22, 2016, at 7:59 AM, Grant Edwards > wrote: > > > >> On 2016-06-22, Random832 wrote: > >>> On Wed, Jun 22, 2016, at 10:19, Grant Edwards wrote: > >>> > >>> Is that guaranteed by Python, or just a side-effect of the > >>> implementation? Back in the days when Python used native C > >>> integers I think the latter. > >> > >> AIUI, native C integers have never reliably supported signed zero > >> even with representations that naively seem to have it. There's no > >> well-defined way to detect it - no int version of copysign, for > >> instance - and implementations are free to erase the distinction on > >> every load/store or define one of them to be a trap representation. > > > > It's been almost 25 years since I used hardware that supported signed > > zero integers (CDC 6600). I don't recall there being a C compiler > > available. We used Pascal and assembly, though I think FORTRAN was > > what most people used. I don't recall whether the Pascal > > implementation exposed the existence of -0 to the user or not. > > When I took mathematics in college, the following was true: > > -1 * 0 = 0 > > I would probably have gotten rapped on the knuckles by my instructors if I > answered -0. Zero was zero. No plus or minus about that. No discussion of > signed integers ever mentioned signed zero. > > Did I miss something in college? > I can't remember where I came across the concept. It might have been in calculus. Zero can be thought of as the asymptotic value of 1/n as n approaches infinity. If so, then negative zero would be the asymptote of -1/n as n approaches infinity.