Re: On writing negative zero - with or without sign
- From: tholen@xxxxxxxxxxxx
- Date: 19 Jul 2007 18:15:57 GMT
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
to address this property.
I am unfamiliar with the concept of interval arithmetic.
....
REAL X,Y
LOGICAL L
X = 1.0
Y = SQRT(X*X)
L = X == Y
....
What about the reverse case:
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?
.
- Follow-Ups:
- Flavors of zero, flavors of infinity Re: On writing negative zero - with or without sign
- From: Kevin G. Rhoads
- Re: On writing negative zero - with or without sign
- From: Jan Vorbrüggen
- Re: On writing negative zero - with or without sign
- From: James Giles
- Re: On writing negative zero - with or without sign
- From: glen herrmannsfeldt
- Flavors of zero, flavors of infinity Re: On writing negative zero - with or without sign
- References:
- On writing negative zero - with or without sign
- From: Jerry DeLisle
- Re: On writing negative zero - with or without sign
- From: robert . corbett
- Re: On writing negative zero - with or without sign
- From: Richard Maine
- Re: On writing negative zero - with or without sign
- From: robert . corbett
- Re: On writing negative zero - with or without sign
- From: Richard Maine
- Re: On writing negative zero - with or without sign
- From: Terence
- Re: On writing negative zero - with or without sign
- From: Ron Shepard
- Re: On writing negative zero - with or without sign
- From: James Giles
- Re: On writing negative zero - with or without sign
- From: tholen
- Re: On writing negative zero - with or without sign
- From: James Giles
- Re: On writing negative zero - with or without sign
- From: tholen
- Re: On writing negative zero - with or without sign
- From: James Giles
- On writing negative zero - with or without sign
- Prev by Date: Re: f77, f90, f95 or f2003?
- Next by Date: Re: A basic question about linked list
- Previous by thread: Re: On writing negative zero - with or without sign
- Next by thread: Re: On writing negative zero - with or without sign
- Index(es):
Relevant Pages
|