Espen has already contributed a good link regarding the rounding. Thanks Espen, that got my 5.
The reason I post this solution is to make you aware that there is better algorithm for line drawing that you might not be aware of. It was invented by Jack E. Bresenham and is named after him.
Bresenham's Algorithm in Wikipedia
The nice thing about this algorithm is that it runs completely with integer operations. And that adds tremendously to its speed. Every conversion between floating-point format and integer is always a relatively slow operation. Or in your case you need a floating-point add (+0.5) a function call to floor, and probably later on when it comes to the real drawing a conversion to int. So for serious graphics work I would suggest you take a look at Bresenham's algorithm. It's not hard to convert the pseudo-code given on the Wiki page into C code.
Back to the subject of rounding: I have found the implicit conversion from double to int by the C runtime system sometimes a very slow operation. That was true VC++ V6; don't know if that is still so in newer versions. As a good work-around I found somewhere on CodeProject the following code (sorry that I cannot give credit to the author; might have been the following article:
Floating-Point utilities):
inline long RoundInt (double a)
{
long retval;
__asm fld a
__asm fistp retval
return retval;
}
This little inline function translates into only two machine instructions and is according to my measurements way faster than floor (x + 0.5) and the following implicit conversion to int.
Hope that helped you a little further along the way.