3. Instructions
464
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Application example
In this example, the 4-digit BCD number in D0 is divided by the 4-digit BCD number in D1 and the
floating-point result is written to D3 and D2.
(Example) 0.3452
×104÷0.0079×104=0.436962×102
1
2
3
4
5
6
7
@MOV
@MOV
@MOV
@MOV
@MOVD
@MOVD
@MOVD
@MOVD
@FDIV
0.00
D100
D102
D101
D103
D0
D101
D0
D100
D1
D103
D1
D102
D100
D102
D2
D0
3 4 5 2
D101 D100
4 3 4 5 2 0 0 0
D1
0 0 7 9
D103 D102
4 0 0 7 9 0 0 0
D101 D100
4 3 4 5 2 0 0 0 0.3452000 10
4
D103 D102
4 0 0 7 9 0 0 0 0.0079000 10
4
D3 D2
2 4 3 6 9 6 2 0 0.4369620 10
2
÷
×
×
×
To perform the floating point division, the BCD value
in D0 is converted to floating-point format in D101
and D100 and the BCD value in D1 is converted to
floating-point format in D103 and D102.
2. D101 and D103 are set
to 4000.
The result of the calculation and the quotient are output
to D3 and D2.
1. D100 and D102 are set
to 0000.
3 to 6. MOVD(083) is used to move the digits of the
original source words to the proper digits in the
2-word floating-point formats.
7. FDIV(079) divides the floating-point number in D101
and D100 by the floating-point number in D103 and
D102.