Sam Wilson wrote
"Michael R N Dolbear" wrote:
... though I don't know of any higher-level languages that let
you
distinguish between +0 and -0 integers even on hardware that
supports
the distinction. (And FWIW the TCP/IP suite uses ones-complement
arithmetic in its checksum calculations.)
Fortran on the Univac/Unisys 1100 series (which used one-complement
single and double integers and indeed floating point). ...
So are you saying you could write IF (I .EQ. -0) and have it behave
differently from (I .EQ. 0) or (I .EQ. +0), or just that you could do
bitwise ops?
There were lots of ways of doing it but I would have used something
like
IF (I .EQ. 0 .AND AND(I,1) .NE. 0)
IF (I .EQ. -0) however (and any other operation using only Standard
Fortran operations and functions) has to give the same result
irrespective of the underlying hardware or be in violation of Standard
Fortran.. Thus when one looked at the compiler generated code there was
an occasional "force -0 to +0" sequence.
In memory of a great mainframe
http://www.fourmilab.ch/documents/univac/minuszero.html
--
Mike D