Section 2: Compiler
61
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
include file (tiams.h) supplied with the TI-89 / TI-92 Plus SDK, BCD16 has been
defined as double, and should be used when coding applications as a reminder
that routines containing floating-point operations may not be portable code.
2.9.4. Floating-Point
Representations
All TI BCD floating points are 10 byte objects. The first two bytes in the TI BCD
floating-point format are the mantissa sign and exponent. The mantissa sign is
the most significant bit of that word (1=negative, 0=positive) and the other 15 bits
are a 0x4000 biased exponent, where a value less than 0x4000 represents a
negative exponent, and a value greater than 0x4000 represents a positive
exponent. The memory address of a floating-point data object is the address of
the first byte of the sign/exponent. The decimal point is assumed to be after the
first BCD mantissa digit. The mantissa consists of 16 BCD digits, with digits 15
and 16 always equal to 0 in a float.
double and float
Low address
High Address
2 bytes
MSD 8 bytes LSD
0x4000 biased
1 . . .
. . . 15
16
exp and sign
16 digit mantissa (digits 15 and 16=0 for float)
Figure 2.2: Internal TI BCD Floating
-
Point Representation
Following are some examples of common floating-point values shown as if
written in 68000 assembly language:
_PI:
.word 0x4000
; 3.141592653589793
.long 0x31415926,0x53589793
_FPZERO:
.word 0x4000
; 0
.long 0,0
_FPPT001:
.word 0x3FFD
; .001
.long 0x10000000,0
_FPPTFIVE:
.word 0x3FFF
; .5
.long 0x50000000,0
_FPONE:
.word 0x4000
; 1
.long 0x10000000,0
_FPNEG1:
.word 0xC000
; -1
.long 0x10000000,0
_FPTEN:
.word 0x4001
; 10
.long 0x10000000,0