Integer Types; Floating-Point And Integer Types - Texas Instruments TI-89 Software Manual

Sierra c assembler
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Section 2: Compiler
converting between different integer types, the resultant representation is easily
determined since the target machine uses a two's complement representation.
Conversions between integer types of the same length involve no change in
representation. Conversions from longer integer types to shorter integer types
involve a truncation of the excess high order bits. Conversions from shorter
integer types to longer integer types involve the padding of the additional high
order bits with all 1's or 0's.
2.10.2.

Integer Types

When an integer of one type is converted to an integer of another type, the
resultant value is determined according to the following rules:
When a signed integer type is converted to another signed integer type of
equal or greater length, the value remains unchanged.
When an unsigned integer type is converted to another unsigned integer type
of equal or greater length, the value remains unchanged.
When an unsigned integer type is converted to an integer type of greater
length, the value remains unchanged.
When an integer type is converted to an integer type of shorter length, the
resultant value is the value of the truncated bit pattern as interpreted by the
new type.
When a signed integer type is converted to an unsigned integer type of
greater length the resultant value is unchanged if the value of the signed
integer was non-negative. Otherwise, the bit pattern representation in the
unsigned integer is determined by promoting the signed integer to a signed
integer of the same length as the unsigned integer.
When an integer type is converted to an integer type of the same length, the
resultant value is the value of the bit pattern as interpreted by the new type.
2.10.3.

Floating-Point and Integer Types

When a floating-point type is converted to an integer type, the resultant value is
determined by discarding the fractional part. If the conversion is to an unsigned
long and the value of the integral part cannot fit in the space provided, the
behavior is undefined. If the conversion is to any other integer type and the value
of the integral part cannot fit, the integral part is first assigned to a signed long
and is then converted to the specified integer type using the integer conversion
rules. If the integral part cannot fit in a signed long, it is assigned the largest
positive or negative value (depending on the sign of the integral part) that can be
represented by a signed long.
TI-89 / TI-92 Plus Sierra C Assembler Reference Manual
Not for Distribution
71
Beta Version February 2, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-89 plusTi-92 plus

Table of Contents