App. - 44
Project name QA-14
Program name MAIN
Appendix 4.26 Example of operation program calculating square root of data
The data stored in D5 is calculated to its square root and the result is stored in D6
and D7.
X0
0
D6
D5
BSQR
K4Y50D7MOVP
Sets data
D5
K4X20
MOVP
K4Y60
D6
MOVP
Square root
operation
Square root
(integral part)
Square root
(decimal part)
D5
D6 D7
=
0 to 9999
(BCD value)
0 to 9999
(BCD value)
0 to 9999
(BCD value)
Results of square root operation are stored as follows.
Integral part Decimal part
A value in 5th decimal digit is rounded off.
Therefore, a value in 4th decimal place
has error of ±1.
REMARK
QCPUs provide square root operation instructions for data in a real number
(floating point) format.