J3/04-305 Date: 5-May-2004 To: J3 From: Interop/interp/Bill Long Subj: Answer to F90 interpretation # F90/000207 NUMBER: F90/000207 TITLE: Integer bit-model inconsistency KEYWORDS: Bit manipulation procedures, models for integer data DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Is the following observation true? [F90 185:last sentence of 13.5.7] and [WG5/N1176, 219:22+] says ``In particular, whereas the models are identical for w_{z-1}=0, they do not correspond for w_{z-1}=1 and ...'' This statement assumes r==2 in the model for integer data defined in 13.7.1, it is not true for general r. The above sentence should be changed to something like ``In particular, whereas the models are identical for r=2 and w_{z-1}=0, they do not correspond for r/=2 or w_{z-1}=1, and ...'' ANSWER: Yes. DISCUSSION: The integer model in 13.7.1 describes integer values using a signed-magnitude, base r representation. This model is intended to provide definitions for the parameters q and r that are used in the computations of the results for certain numeric inquiry functions. The representation is not intended to describe how integers are stored in memory and, indeed, no common implementation uses a signed-magnitude representation. The bit model in 13.5.7 describes a method for characterizing a sequence of bits by specifying an ordering and position number (the index k) and the number of bits (z) in the sequence. The bit position numbering and the sequence size parameter are used in the description of the bit manipulation and BIT_SIZE intrinsics. The INTEGER data type is overloaded in Fortran to specify both numerical integers and bit sequences. The consequential attempt to relate the integer model to the bit model leads to the mismatched text quoted. This attempt, which exists in both f95 and f03, is fundamentally flawed. Rather than patching over this mismatch with qualifications, a future version of the standard should correct the underlying defect of specifing the INTEGER type for the arguments that represent bit sequences in the descriptions of the bit manipulation and BIT_SIZE intrinsics. EDITS: none SUBMITTED BY: Michael Hennecke HISTORY: submitted Mar. 12, 1996 (first appeared in 96-006r2) WG5/N1404 Draft answer 00-260 m154 Passed by J3 meeting 00-329 m155 Failed J3 letter ballot WG5/N1452 Suggested revision 01-292 m158 Passed by J3 meeting 11-1 01-380 m159 Failed J3 letter ballot 04-305 m168 Submitted for J3 meeting vote