# Re: On writing negative zero - with or without sign

James Giles writes:

....

It certainly can represent zero: as one of many possible values
of an approximation that includes zero. If that's your definition
of representing an "exact" zero...

My definition of an "exact" zero is whatever internal representation
is used when two identical internal representations are differenced.

Ok, but there are two such numbers. Minus zero and plus zero are
both allowed as results of that operation.

Why not three? Minus zero, plus zero, and blank zero?

Which of those is "exact" zero?

Maybe I've misunderstood the earlier discussion, but I thought that
minus zero applied only to cases where the actual numerical value
was in fact negative, but the chosen display format was insufficient
to show any significant digits, therefore the number would be displayed
as all zeros, with the question being whether to display the minus sign
or not. For example, should the value -1.2E-5, when displayed with the
format edit descriptor F4.1, be -0.0 or 0.0?

As far as I am concerned, there is only one exact zero, not two, and
not three, and there should be no sign associated with an exact zero.

They both compare equal to plus zero (they both compare
equal to minus zero). This all disregards the known property that
differences of nearly identical (or, in this case, identical) values
leaves little or no significance in the result (at least assuming the
numbers being subtracted are the result of prior calculation).
Again I point out that things like interval arithmetic were indended

I am unfamiliar with the concept of interval arithmetic.

....

REAL X,Y
LOGICAL L

X = 1.0
Y = SQRT(X*X)
L = X == Y

....

Y = (SQRT(X))**2

The set of values for which L will be .TRUE. for that changed
expression is different, but there are numbers (1.0 included)
for which I would expect .TRUE. regardless of rounding mode.
The set is somewhat smaller than for the original example.
And of course Fortran can still see the identity that SQRT(X)**2
is X. (Some people have disputed whether Fortran is permitted
to disregard the fact that negative values of X are invalid in
the original expression. I won't debate it here.)

Suppose Y had been declared as COMPLEX?

.

## Relevant Pages

• Re: On writing negative zero - with or without sign
... exact zero, contrary to your claim that there is no such thing. ... And I noted that there is a subset of continuous reals that can be ... representation to account for "actual zero"). ...
(comp.lang.fortran)
• Re: On writing negative zero - with or without sign
... I responded to the issue of an "exact" zero. ... that doesn't mean I believe the thermometer example represents a ... Propagate the quantization error of 0.1 degrees. ...
(comp.lang.fortran)
• Re: On writing negative zero - with or without sign
... exact zero, contrary to your claim that there is no such thing. ... that using float for something *other* than simulating continuous reals ... "exactitude" in general, but rather a very specific issue, namely ...
(comp.lang.fortran)
• Re: On writing negative zero - with or without sign
... of representing an "exact" zero... ... My definition of an "exact" zero is whatever internal representation ... *only* value associated with that approximation. ... A subset of floating point numbers can have an exact representation. ...
(comp.lang.fortran)
• Re: On writing negative zero - with or without sign
... I sure hope that a program can represent an exact zero. ... programs represent, manipulate, and produce approximations. ... (which is not what floating point does) ...
(comp.lang.fortran)