"floor( )" only accepts floating-point input, and output. When you assign a floating-point value to an integral variable, the number on the right-hand side of the decimal place is truncated, leaving you with a whole number. Here's an example:
int X(100.10f); // the ".10" is removed, leaving "100" behind.
It was a simple math error. not an issue of data types. At that point in the code position[n-count] //3 didn't even have a value so I was effectively dividing by zero.
the correct line should have read.
int middlespacing=floor((position[n - count +1] - position[0])/(n-count+1));