User Tools

Site Tools




Round down to the nearest whole number.

Dim A As Single, B As Single
B = 3.5
A = Floor B     ' Floor 3.5 gives 3.
Debug Float A   ' Print 3.0

If copying the result to one of the Ladder Logic registers, please use a temporary Integer variable first.

Dim S As Single
Dim I as Integer
S = 3.5
I = Floor S     ' Temporarily store the result in `Integer` variable `I`
_D(0) = I       ' Finally copy the value from `I` to the Ladder Logic register

Go CUBLOC home

cubloc/floor/index.txt · Last modified: 2021/11/30 10:53 by COMFILE Technology