I wanted to ceil/floor a number and couldn't find any predefined POUs available. So i tried to create this (ceil):
and it seems didn't work, (probably) because of the REAL number is rounded during conversion to DINT.Note: VAL1 is a DINT with value 1. IN and OUT are both REAL number.
the result is as follow:
IN 0.5 -> OUT 1
IN 1.0 -> OUT 1
IN 1.5 -> OUT 3 (strange, this is the error)
IN 2.0 -> OUT 2
IN 2.5 -> OUT 3
and so, my questions are:
how exactly a number is ceiled* or floored*?
what probably caused this error?
is there any predefined floor/ceil instead?
*I don't know the right grammar