2-245
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Floating-point Math
Instructions
2
FSTR
Function
FSTR(448) expresses the 32-bit floating-point number in S+1 and S (IEEE754-format) in decimal nota-
tion or scientific notation according to the control data in words C to C+2, converts the number to ASCII
text, and outputs the result to the destination words starting at D.
The content of C (Data format) specifies whether to express the number in S+1, S in decimal notation
or scientific notation.
Decimal notation
Expresses a real number as an integer and fractional part.
Example: 124.56
Scientific notation
Expresses a real number as an integer part, fractional part, and exponent part.
Example: 1.2456E-2 (1.2456×10-2)
The content of C+1 (Total characters) specifies the number of ASCII characters after conversion
including the sign symbol, numbers, decimal point and spaces.
The content of C+2 (Fractional digits) specifies the number of digits (characters) below the decimal
point.
The ASCII text is stored in D and subsequent words in the following order: leftmost byte of D, rightmost
byte of D, leftmost byte of D+1, rightmost byte of D+1, etc.
S
S+1
15 87 0
15 87 0
D: 20
31
32
34
00
2D
20
2E
33
00
20
2E
33
2B
30
00
2D
31
32
45
30
00
Decimal notation (C=0 hex)
-1.23456
Example: -1.23456
Floating-point
data
Stored in destination words beginning with D.
Total characters = 10 (C+1 = A hex)
Fractional digits = 2 (C+2 = 2 hex)
Scientific notation (C=0001 hex)
- 1.23E+00
Stored in destination words beginning with D.
Total characters = 8 (C+1 = 8 hex)
Fractional digits = 3 (C+2 = 3 hex)
Conversion to
ASCII text
Conversion to
ASCII text
Rounded off
ASCII characters are stored in order.
(Leftmost byte rightmost byte)
(SP represents a space.)
(SP represents a space.)
ASCII characters are stored in order.
(Leftmost byte rightmost byte)