It is solved: I declared the variables as int and that doesn't work
When I declare the variables as a doubles it works fine.
Strange that I have to use a double for an integer value. Since doubles uses more memory than integers. That might be a bug
For now I will use doubles all over the place to avoid this problem.
