Re: On writing negative zero - with or without sign



On Jul 15, 8:15 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
<robert.corb...@xxxxxxx> wrote:
Because the members of the committee
do not want to rewrite the standard to say what they think it
should mean, they choose to apply a remarkably contorted
interpretations to the standard as written.

I disagree with the characterization of both the motives and
the alleged contortion.

I call it as I see it. I might be wrong, but that is how it
appears to me.


Section 10.6.1 states

(3) On output with I, F, E, EN, ES, D, and G editing,
the representation of a positive or zero internal
value in the field may be prefixed with a plus sign,
as controlled by the S, SP, and SS edit descriptors
or the processor. The representation of a negative
internal value in the field shall be prefixed with
a minus sign.

That statement establishes that zero and positive values are
treated the same for formatted output.

I see no wording that says "the same" or anything like that.

No, but I see the phrase "the representation of a positive or zero
internal value." It certainly seems to me that establishes that
they are treated the same.

How do members of J3 justify treating zero values as negative
values, given the statements quoted above? One member of the
committee has claimed that positive and negative zeros are not
zero values, that they are positive values or negative values.
That interpretation makes the statement cited from Section 4.4.2
irrelevant.

Well. We are clearly getting off into individual opinions here. I do
note that Bob was careful to say "one member". Don't overlook that
when reading. One member is not particularly close to a majority.
In fact, that would be insufficient for a second. I'm not quite
sure what member he is talking about. But it doesn't really matter.
Remember that committee membership is not particularly difficul
to get. The statement that "one member" claims something is a lot
like saying that "one person" claims something. You can find one
person who will claim almost anything; I'm not sure that the
"almost" qualifier is even needed. I've bitched here before about
people trying to give increased credence to an otherwise anonymous
citation by saying that "a committee member" said something.

If we were playing that game, I could raise with a "the editor said",
but I think I'll stick with the technical arguments.

At least two members of the committee have latched on to the
word "may" in the statement cited from Section 10.6.1. They
take the use of that word as meaning that positive and zero
values "may be prefixed with a plus sign, as controlled by the
S, SP, and SS edit descriptors or the processor," but, then again,
they may not.

I'm one of the members who indeed think that the word "may" means
"may", but the above is an inaccurate representation of the
position.

You are indeed one of the two to whom I was referring.

The "but
then again they may not" doesn't make sense to me as particularly
related. As one of the people who I presume Bob is citing, I think
I get some say in what I said. It wasn't that. Of course it might
not (I'd say "might" instead of "may" for this usage, but that's a
quibble).

There never has been the least bit of question about the fact that
there might be no prefix at all. In fact, with SS, there is
required to be no prefix for positive values.

Yes. Furthermore, the SP edit descriptor requires that the
external representation of the value be prefixed by a plus sign.

The point was that the above says that "a zero internal may be
prefixed by a plus sign, as controlled". However, that statement is
not exclusionary. It doesn't say that a zero may not ever be
preceeded by a minus sign.

No, it does not say that. It also does not say that a positive
value may not ever be preceded by a minus sign.

In fact, since the above quote explicitly says that a negative value
is prefixed with a minus sign, I find it difficult to interpret it
any other way. A negative zero is negative.

Here we reach the foundation of the difference in our readings.
I interpret a real zero value as being neither positive nor
negative. The standard has the right to say otherwise, but
it does not.

If you want to claim otherwise,
then I'm going to say you have pot/kettle/black problems in talking
about contorted interpretations.

The usual rule in standards is that words have their conventional
meanings unless otherwise specified. My dictionary gives as one
of its definitions of the word "negative"

less than zero and opposite in sign to a positive number
that when added to the given number yields zero

I'll stand by that definition, at least for the mathematical real
numbers. If the committee chooses to define the word "negative"
differently for Fortran's real data type, the committee should
add some mention of it to the standard. I would strongly advise
the committee to avoid doing so, and to clean up the problems
caused by negative zeros in another way.

I have, until now, interpreted the Fortran standard's use of the
terms "negative zero" and "positive zero" as equivalent to the
IEEE Floating-point standard's use of the symbols "-0" and "+0".
IEEE Std. 754 does not use the terms "negative zero" or "positive
zero." I suspect that the authors of that standard would consider
those terms nonsensical. It would have been better if the Fortran
committee had used the terms "plus zero" and "minus zero." I see
now that the translation is getting in the way of clarity.

IEEE Std. 754 states

For any variable that has the value zero, the
sign bit s provides an extra bit of information.
Although all formats have distinct representations
for +0 and -0, the signs are significant in some
circumstances, such as division by zero, and not
in others.

The IEEE floating-point standard does not even hint that a
zero value should be considered positive or negative. Indeed,
it would wreak havoc with that document were zero values to be
considered positive or negative, because postive and negative
values are nonzero values.

The line about how a zero may be prefixed with a plus is perhaps not
perfectly clearly written, in that it doesn't make the parallel
statement that a zero may be prefixed by a negative sign in some
cases, but it at least does not contradict that possibility.

As noted above, under the SP edit descriptor, the external
representation of a zero value must be prefixed by a plus sign.

> They too have to interpret negative zeros as

negative values...

Um, yes. I interpret the modifier "negative" to mean "negative".

Until tonight I did not think that was what the Fortran standard
meant. The concept of a real zero value being positive or negative
is sufficiently problematic, revisions of the Fortran standard should
explicitly call out what it means.

Bob Corbett

.



Relevant Pages

  • Re: On writing negative zero - with or without sign
    ... interpretations to the standard as written. ... That statement establishes that zero and positive values are ... In fact, with SS, there is required to be no prefix ...
    (comp.lang.fortran)
  • Re: On writing negative zero - with or without sign
    ... interpretations to the standard as written. ... but I see the phrase "the representation of a positive or zero ... note that Bob was careful to say "one member". ... required to be no prefix for positive values. ...
    (comp.lang.fortran)
  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... Linkname: c standard - clc-wiki ... with a signed zero (including all IEC 60559 implementations) ... that follow the specification of annex G, the sign of zero ... between brake pedal and brake pads being through a complicated ...
    (comp.lang.c)
  • Re: NULL and zeros
    ... The machine's bizarre internal representation does not excuse the implementation from its obligations. ... standard. ... The standard indeed does not specify what an "all bytes zero" or "all ... the originator of this calloc() is clueless -- my personal ...
    (comp.lang.c)
  • Re: A dead subject
    ... >> made the formula easier, ... > BTW - how many subtractions are required to transform my standard ... Some are already set equal to zero and MOST are not. ... think it is about time that mathematicians stop worshipping zero. ...
    (sci.math)