🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1360

Re: Questions about NCEG

#1360
From: Richard A. O'Keefe
Date: Thu, 31 May 1990 13:19
34 lines
2165 bytes
In article <15570@bfmny0.BFM.COM>, tneff@bfmny0.BFM.COM (Tom Neff) writes:
> Where does it say this?  Requiring that "minus zero" have a distinct
> *internal* representation from "plus zero" says NOTHING about what a
> parser is supposed to do with the string "-0.0".

It's not just a different internal representation.  It behaves differently.
There are three cases:
(a) the language defines -0.0 as one single token string.
    Then the translation is governed by 5.6 and 3.1, so the answer
    must be minus zero

(b) the language defines -0.0 as two tokens
    then 0.0 converts to plus zero, and -(plus zero) is minus zero.

(c) the language defines -0.0 as two tokens, and says explicitly
    that  "- Literal" is translated as the value of "0 - Literal".
    In that case, the translation must be plus zero.

Interpretation (c) violates the fairly strong recommendation of the
appendix, so although it is technically legal, it would be inadvisable.

> ANSI C does require that the strings "-0.0" and "0.0" parse to the same
> internal representation number (right Doug?).  

OOPS.  I would be surprised if it did:  consider the IBM/370 series.
If I remember correctly, because they don't use a hidden bit, and they
do allow unnormalised numbers, they have a _lot_ of internal representations
of 0.0, _one_ of them being all zero bits.  Certainly the B6700's floating-
point representation had that property (though I'd be surprised to find a
C compiler on the descendants of that machine).

-- 
"A 7th class of programs, correct in every way, is believed to exist by a
few computer scientists.  However, no example could be found to include here."
Technical Details
Message-ID: <3122@goanna.cs.rmit.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!samsung!munnari.oz.au!ditmela!yarra!monu6!minyos!goanna!ok
References: <3094@goanna.cs.rmit.oz.au> <1990May29.193451.6533@twinsun.com> <15570@bfmny0.BFM.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!samsung!munnari.oz.au!ditmela!yarra!monu6!minyos!goanna!ok
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.std.c
Subject: Re: Questions about NCEG
Message-ID: <3122@goanna.cs.rmit.oz.au>
Date: 31 May 90 13:19:08 GMT
References: <3094@goanna.cs.rmit.oz.au> <1990May29.193451.6533@twinsun.com> <15570@bfmny0.BFM.COM>
Organization: Comp Sci, RMIT, Melbourne, Australia
Lines: 34