I found two Problems.
the function 'logical()' doesnt care about whether x is integer or not. The solution I have suggested is not integer. This is the reason why my test using 'logical()' wasnt correct. Checking 'isinteger(x)' is also necessary.
Though this doesnt explain why my result is wrong using 'intlinprog' but I know now that I have to look in the constraints. I found indeed that due to cutting of digits some equalities are violated. Using boundary solves the problem.