72
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
2.10.4. Floating-Point Types
Since all TI BCD floating-point data objects are ten bytes, there is no promoting
float
to
double
or demoting
double
to
float
. Explicit type casting of
float
to
double
or
double
to
float
is also ignored. This does not imply that there is no
difference between them. TI floating-point arithmetic will recognize that a
float
has only 14 significant digits. If a cast from
double
to
float
is desired, the
round14
function on the TI-89 / TI-92 Plus is available. However, it is strongly
recommended to always use
double
, taking advantage of the increased
accuracy. (See section
2.9.3 Floating-Point Types
for more information.)
2.10.5. Usual Arithmetic Conversions
Most binary operators that require operands of arithmetic type cause implicit
conversions (to yield a common type). These conversions are known as the
usual arithmetic conversions
. The first applicable rule in the following lists
specifies the performed conversions:
•
If either operand is of type
double
, the other operand is converted to type
double
.
•
If either operand is of type
float
, the other operand is converted to type
float
.
•
If either operand is of type
unsigned long int
, the other operand is converted
to type
unsigned long int
.
•
If one operand has type
long int
and the other has type
unsigned int
, the
conversion depends on the specified integer size (see
-XI
flag). When 16-bit
integers are used (as on the TI-89 / TI-92 Plus), the operand of type
unsigned int
is converted to the type
long int
; otherwise, both operands are
converted to the type
unsigned long int
.
•
If either operand is of type
long int
, the other operand is converted to type
long int
.
•
If either operand is of type
unsigned int
, the other operand is converted to
type
unsigned int
.
•
If either operand is
not
of type
int
, it is converted to type
int
. (Exception: if
16-bit integers are used, as on the TI-89 / TI-92 Plus, and the operand type is
unsigned short int
, it will be converted to
unsigned int
in order to preserve
its value.)
•
If both operands are of type
int
, no conversion is necessary.