Re: On writing negative zero - with or without sign
- From: "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx>
- Date: Tue, 17 Jul 2007 19:39:35 GMT
tholen@xxxxxxxxxxxx wrote:
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. Which of those is "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.
....
....
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.)
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
.
- Follow-Ups:
- Re: On writing negative zero - with or without sign
- From: tholen
- 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
- On writing negative zero - with or without sign
- Prev by Date: Re: segmentation fault
- Next by Date: Re: A question about OOP in Fortran?
- 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
|
|