it seems to be because colors have a precision of 8 bits (between 0 and 255),
Therefore, when it tries to appriximate 0.5, the best it can do is 128/255 which is equal to what you get
(0.5019...)