26.10.2012 Views

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Floating-Point Math Instructions<br />

8.4 Floating-Point Math Instructions: Extended<br />

8.4.1 SQR Generate the Square of a Floating-Point Number (32-Bit)<br />

Format<br />

SQR<br />

Description of instruction<br />

Result<br />

Example<br />

SQR (generate the square of an IEEE-FP 32-bit floating-point number) calculates<br />

the square of a floating-point number (32-bit, IEEE-FP) in ACCU 1. The result is<br />

stored in accumulator 1. The instruction influences the CC 1, CC 0, OV, and OS<br />

status word bits.<br />

The contents of accumulator 2 (and also the contents of accumulator 3 and<br />

accumulator 4 for CPUs with four ACCUs) remain unchanged.<br />

The result in ACCU 1 is CC 1 CC 0 OV OS Note<br />

+qNaN 1 1 1 1<br />

+infinite 1 0 1 1 Overflow<br />

+normalized 1 0 0 -<br />

+denormalized 0 0 1 1 Underflow<br />

+zero 0 0 0 -<br />

-qNaN 1 1 1 1<br />

<strong>STL</strong> Explanation<br />

OPN DB17 //Open data block DB17.<br />

L DBD0 //The value from data double word DBD0 is loaded into ACCU 1. (This<br />

value must be in the floating-point format.)<br />

SQR //Calculate the square of the floating-point number (32-bit, IEEE-FP)<br />

in ACCU 1. Store the result in ACCU 1.<br />

AN OV //Scan the OV bit in the status word for "0."<br />

JC OK //If no error occurred during the SQR instruction, jump to the OK jump<br />

label.<br />

BEU //Block end unconditional, if an error occurred during the SQR<br />

instruction.<br />

OK: T DBD4 //Transfer the result from ACCU 1 to data double word DBD4.<br />

<strong>Statement</strong> <strong>List</strong> (<strong>STL</strong>) for S7-300 and S7-400 Programming<br />

8-10 A5E00706960-01

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!