Added (double) casting in black and white
Switched to using math.h 's rounding function