when you want to round something odd that round has trouble handling go back to the definition of rounding.
To round a number you add 0.5 * y and then round down; where y is half of the number you want to round off to.
i.e.
Round to 1, y = 0.1
Round to 10, y = 5
Okay so you want to round to 1000 this makes y = 500.
So the first step is
$x += 500
But how to round this down? The answer is with modulous arithmatic.
$x -= ($x%1000);
all done now.