I read about a rounding technique at this question. Converting color value from float 0..1 to byte 0..255
You have a float on the range from 0 to 1 and you want to map it to the byte integer range of 0-255. So you multiply the 0-1 number by 255f, and then convert that number to a byte. Because all conversions just floor the decimal part of the float you need a way to make it so when it is floored it will achieve the desired rounded result.
My idea is to just add 0.5f before it is converted into a byte.
However, I noticed something new that I don't understand on that page I linked. He maps 0-1 to 256 instead, and this somehow will achieve a rounded result.
I tested values to see if it works and it appears it does. I just don't understand why. Can someone show me a proof?