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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Floating-Point Math Instructions<br />

8.4.4 LN Generate the Natural Logarithm of a Floating-Point Number<br />

(32-Bit)<br />

Format<br />

LN<br />

Description of instruction<br />

Result<br />

Example<br />

LN (generate the natural logarithm of an IEEE-FP 32-bit floating-point number)<br />

calculates the natural logarithm (logarithm to base e) of a floating-point number<br />

(32-bit, IEEE-FP) in ACCU 1. The result is stored in accumulator 1. The input value<br />

must be greater than zero. The instruction influences the CC 1, CC 0, UO, and OV<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 />

-zero 0 0 0 -<br />

-denormalized 0 0 1 1 Underflow<br />

-normalized 0 1 0 -<br />

-infinite 0 1 1 1 Overflow<br />

-qNaN 1 1 1 1<br />

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

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

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

LN //Calculate the natural logarithm of the floating-point number<br />

(32-bit, IEEE-FP) 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 instruction, jump to the OK jump<br />

label.<br />

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

instruction.<br />

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

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

A5E00706960-01 8-13

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

Saved successfully!

Ooh no, something went wrong!