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.

Conversion Instructions<br />

3.18 RND- Round to Lower Double Integer<br />

Format<br />

Description<br />

Status word<br />

Example<br />

RND-<br />

RND- (conversion of a 32-bit IEEE floating-point number to 32-bit integer) interprets<br />

the contents of ACCU 1 as 32-bit IEEE floating-point number. The instruction<br />

converts the 32-bit IEEE floating-point number to a 32-bit integer (double integer)<br />

and rounds the result to the largest whole number less than or equal to the<br />

floating-point number that is converted (IEEE rounding mode "round to -infinity"). If<br />

the number is out of the permissible range, then the status bits OV and OS are set to<br />

1. The result is stored in accumulator 1.<br />

Conversion is not performed and an overflow indicated in the event of a fault<br />

(utilization of a NaN or a floating-point number that cannot be represented as a 32-bit<br />

integer number.)<br />

BR CC 1 CC 0 OV OS OR STA RLO /FC<br />

writes: - - - x x - - - -<br />

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

L MD10 //Load the floating-point number into ACCU 1-L.<br />

RND- //Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit)<br />

and round result. Store result in ACCU 1.<br />

T MD20 //Transfer result (double integer number) to MD20.<br />

Value before conversion Value after conversion<br />

MD10 = "100.5" => RND- => MD20 = "+100"<br />

MD10 = "-100.5" => RND- => MD20 = "-100"<br />

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

3-18 A5E00706960-01

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

Saved successfully!

Ooh no, something went wrong!