10-154
To: J3
From: Robert Corbett
Subject: Interpretation Request: Can zero have more than one
bit sequence representation?
Date: 2010 May 31
All references are to J3/10-007.
QUESTIONS:
Question (1):
Some processors provide two internal representations for the
integer value zero. The ones' complement representation of signed
integers and the signed-magnitude representation of signed
integers both provide two representations for zero. Must a
processor for such a machine use a bit sequence consisting of all
zero bits to represent zero, regardless of the internal
representation of zero?
Question (2):
The Fortran 2008 standard [13.3.1, 317:9] states
The interpretation of a negative integer as a
sequence of bits is processor dependent.
Could a standard-conforming processor interpret all negative
integers as a sequence of all zero bits?
ANSWERS:
Answer to question (1): Yes.
Answer to question (2): Yes.
DISCUSSION:
Requiring the bit sequence representation of the integer zero to
consist of all zero bits will limit the utility for the new bit
intrinsics for machines that use the ones' complement and signed-
magnitude representations of signed integers. Such machines are
now so rare, the loss is small.
Interpreting all negative integers as sequences of zero bits is a
bad implementation choice, but is not prohibited by the standard.
No portable program can rely on the bit sequence representation
of a negative integer in any case.
EDITS:
None.