FLOOR block
Short summary
Name |
FLOOR |
→POU type |
|
Category |
|
Conform to →IEC-standard |
not defined in IEC-standard |
Graphical interface |
|
Available since |
|
Functionality
The block returns the result of a rounding down operation:
The floating-point number connected to input IN is rounded downwards to the largest previous integer.
Compare: "CEIL block", "ROUND-Baustein"
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
IN |
REAL, LREAL |
value to round |
Return value: |
– |
REAL, LREAL |
|
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
See:
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic .
Example for usage within ST-editor
PROGRAM Test
VAR
result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15 : REAL;
END_VAR
result1 := FLOOR(
2.8
); (* The variable
'result1'
evaluates to
'2.0'
. *)
result2 := FLOOR(
2.5
); (* The variable
'result2'
evaluates to
'2.0'
. *)
result3 := FLOOR(
2.01
); (* The variable
'result3'
evaluates to
'2.0'
. *)
result4 := FLOOR(
2.0
); (* The variable
'result4'
evaluates to
'2.0'
. *)
result5 := FLOOR(-
2.0
); (* The variable
'result5'
evaluates to
'-2.0'
. *)
result6 := FLOOR(-
2.3
); (* The variable
'result6'
evaluates to
'-3.0'
. *)
result7 := FLOOR(-
2.5
); (* The variable
'result7'
evaluates to
'-3.0'
. *)
result8 := FLOOR(-
2.99
); (* The variable
'result8'
evaluates to
'-3.0'
. *)
result9 := FLOOR(
0.000001
); (* The variable
'result9'
evaluates to
'0.0'
. *)
result10 := FLOOR(
0.0
); (* The variable
'result10'
evaluates to
'0.0'
. *)
result11 := FLOOR(-
0.000001
); (* The variable
'result11'
evaluates to
'-1.0'
. *)
result12 := FLOOR(
3
.402823466e+
38
); (* The variable
'result12'
evaluates to
'340.2823466385289E+36'
. *)
result13 := FLOOR(
1
.175494351e-
38
); (* The variable
'result13'
evaluates to
'0.0'
. *)
result14 := FLOOR(-
3
.402823466e+
38
); (* The variable
'result14'
evaluates to
'-340.2823466385289E+36'
. *)
result15 := FLOOR(-
1
.175494351e-
38
); (* The variable
'result15'
evaluates to
'-1.0'
. *)
END_PROGRAM
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.