Chapter Contents

Previous

Next
Code Generation Conventions

Arithmetic Data Types

The compiler implements the standard C data types as follows:

All data types use the normal 370 representation. Data Type Characteristics summarizes the characteristics of the arithmetic data types.

Data Type Characteristics
Type Length Alignment Range
char 1 byte 0 to 255 (EBCDIC character set)
signed char 1 byte -- 128 to 127
unsigned char 1 byte 0 to 255 (EBCDIC character set)
short 2 halfword -- 32768 to 32767
unsigned short 2 byte 0 to 65535
int 4 word -- 2147483648 to 2147483647
long 4 word -- 2147483648 to 2147483647
unsigned 4 word 0 to 4294967295
float 4 word =/ -- 5.4E -- 79 to =/ -- 7.2E75
double 8 doubleword =/ -- 5.4E -- 79 to =/ -- 7.2E75
long double 8 doubleword =/ -- 5.4E -- 79 to =/ -- 7.2E75
char unsigned char defines an 8-bit unsigned integer



signed char short short int defines an 8-bit signed integer

defines a 16-bit signed integer

unsigned short unsigned short int defines a 16-bit unsigned integer



int long long int defines a 32-bit signed integer



unsigned unsigned int unsigned long int defines a 32-bit unsigned integer



float defines a 32-bit signed floating-point number in the standard 370 representation, that is, a sign bit, a 7-bit biased hexadecimal exponent, and a 24-bit fractional part. The exponent bias is 64. All constants and results generated by compiled code are normalized (except for constants specified in hexadecimal notation). This representation is equivalent to approximately 6 or 7 decimal digits of precision



double long double defines a 64-bit signed floating-point number in the standard 370 representation, that is, a sign bit, a 7-bit biased hexadecimal exponent, and a 56-bit fractional part. The exponent bias is 64. All constants and results generated by compiled code are normalized (except for constants specified in hexadecimal notation). This representation is equivalent to approximately 16 or 17 decimal digits of precision



Note that in contrast to the signed integer representations, negative floating-point values are not represented in two's complement notation; positive and negative numbers differ only in the sign bit. Also note that there are multiple representations of 0; any value that has a 0 fractional part is treated as 0 by the IBM 370 floating-point instructions, regardless of the exponent value.

Code that checks float or double objects for 0 by means of type punning (that is, examining the objects as if they were int or some other nonfloating-point type) may assume (falsely) negative 0 not to be 0.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.