5 Categories and Use of Basic Application Instructions API 127 Operands: S : Source device D : Operation result Explanations: 1. This instruction performs a square root operation on the floating point value in S and stores the result in D . All data will be operated in binary floating point format and the result will also be stored in floating point format 2. S can only be a positive value. Performing any square root operation on a negative value will result in an “operation error” and instruction will not be executed. Operation error flag will be ON and error code “0E19” will be recorded. 3. F refers to floating point input. Be sure to add a decimal point when using it. 4.
If S is specified with floating point value F, the instruction will operate in binary floating point. 5. Only 32-bit instructions DESQR and DESQRP are applicable. 6. If operation result of D is 0 (zero), Zero flag will be ON. 7. Flags: Program Example 1: When X0 = ON, the square root of binary floating point (D1, D0) is stored in (D11, D10) after the operation of square root. X0 (D11, D10) Binary floating point Binary floating point Program Example 2: When X2 = ON, the square root of F1234.0 (automatically converted to binary floating value) is stored in (D11, D10) D10 Points to note: For floating point operations, see “5.3 Numeric Values for Data Processing” .
DVP-PM Operation Instruction 5-106 Mnemonic Operands Function Controllers 20PM 10PM D ESQR P Floating Point Square Root Type OP Bit Devices Word Devices Program Steps X Y M S F H KnX KnY KnM KnS T C D V Z D S * * D * OX O100 Zero flag M1808 M1968 Operation error M1793 M1953 DESQR D0 D10 (D1, D0) X DESQR F1234.0