Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

FX-SDD006A

DATE: NOVEMBER 1993


TM PAGE: 1 OF 2

AN INTRODUCTION TO
NUMBER FORMATS FOR THE FX
Introduction
The FX PC uses data devices to hold number Here the 2,998 would be the mantissa and the 5 would
information. The FX PC can store numbers in any of be the exponent.
three formats:
The mantissa stores the value of the number but it is
a) Decimal (whole numbers) truncated to 4 significant figures with NO ROUNDING.
It is also kept within the following limits:
b) Scientific notation
± 1,000 to 9,999 or 0
c) Floating Point
The exponent is used to determine the number of FX2
Decimal Format decimal places the decimal point should be moved to
give the actual number. For Scientific notation format
The most common format used by PCs is Decimal the limits for the exponent are:
numbers. This format stores the number as an integer –41 to +35
i.e. there are no decimal places.
Unfortunately, the FX can not use the scientific format
The decimal format for numbers allows the programmer for calculations. This means the scientific format must
to use either single word devices (16 bits) or double be converted to floating point to perform all math
word devices (32 bits). functions.
A single word device (e.g. D142) can store a number
from -32768 up to +32767 in 1 unit steps.
Floating Point Format for data
A double word device (e.g. D173 and D172) combines A number held in the floating point format allows both
two data registers to give a possible range from very big numbers and very small numbers to be stored
–2147483648 up to +2147483647 in 1 unit steps. and operated upon in the PC.

This is sometimes not accurate enough and fractions Using floating point format instead of the decimal
are occasionally needed; particularly if extensive format means that numbers that have fractional parts
mathematical calculations involving divisions are such as
used.
PI,π ≈ 3.145927
The Scientific Notation Format for Data and numbers beyond the range of a double word
device such as
This is very closely related to the standard scientific
notation. The number is stored in a format similar to Avogadro’s constant ≈ 6.022× 1023mol−1
scientific notation with a mantissa and an exponent.
can be used.
The following diagram shows an example of the
scientific data format. What Is Floating Point
D121 (16 bits) D120 (16 bits) Floating point is a method of storing numbers that
b15 b0 b15 b0

require a whole and fractional part to be maintained.


EXPONENT MANTISSA The speed of light C (299,792,458 m/s) could be
SIGN (for exponent) SIGN (for mantissa) stored in a double word but any multiplications would
quickly give a number that is too big; which is why it
The value of the number is equivalent to: would be better to use floating point format.

D120 × 10 D121 The difference between floating point in the PC and


standard scientific notation is that the number base
For example, the speed of light C, is used in floating point is binary; the PC understands
this better.
299,792,458 m/s
or about

2997× 105 m/s


FX-SDD006A
DATE: NOVEMBER 1993
TM PAGE: 2 OF 2

AN INTRODUCTION TO
NUMBER FORMATS FOR THE FX
To further complicate our understanding both the The following figure depicts the conversion between
mantissa and the exponent are stored together in a each format and which functions should be used. To
double word. help find these functions the number of the associated
data sheet explaining each function is listed below.
A Brief Look at the Float Structure
FLT BCD
D101 (16 bits) D100 (16 bits) M8023 OFF M8023 ON
b15 b0 b15 b0 FLOATING SCIENTIFIC
DECIMAL
POINT NOTATION
EXPONENT MANTISSA (23 bits) FLT BIN
(8 bits) M8023 ON M8023 ON
SIGN (1 bit)
M8023 OFF M8023 ON MONITOR
FX2
The sign bit is for the overall value; the exponent and
the mantissa are held in binary. However, the actual
interpretation of the bits is more complicated and MATHAMATICAL CALCULATIONS

further explanations are made in detail in sheet


number FX–SDD007.
The whole pattern seems complex to our eyes and for Operation Sheet Number
this reason the FX also understands the scientific FLT (M8023 OFF) FX–SAD491
format of data.
FLT (M8023 ON) FX–SAD492
Converting To Each Number Format BCD (M8023 ON) FX–SAT182
It is quite clear that each of these number formats are BIN (M8023 ON) FX–SAT192
quite distinct in their construction and interpretation. Mathematical ADD FX–SAL201
We must have some method to convert between each Calculations SUB FX–SAL211
type. on Decimal MUL FX–SAL221
(M8023 OFF) DIV FX–SAL231
Within the FX there is a collection of functions de- SQRT FX–SAD481
signed to convert between each number format. This
allows us to enter data in a format that we understand Mathematical ADD FX–SAL202
and then convert to the most appropriate format for the Calculations SUB FX–SAL212
operation that we are doing. on Floating Point MUL FX–SAL222
(M8023 ON) DIV FX–SAL232
SQRT FX–SAD482

Further References:
Details of decimal data format can be found in sheets FX–SDD001 to FX–SDD005.
A full explanation of the floating point structure is in sheet FX–SDD007.

You might also like