When the maximum value is odd...
When a quantity is measured as an integer in a range from zero up through some maximum value and that maximum value is odd, then 50% of the maximum cannot be expressed as an integer.
This aspect is simple and obvious when you're thinking about it but sometimes it can get overlooked, starting you down the slippery slope of letting sloppiness leak into your technical writing. For example, I once saw a technical reference document refer to #808080
as having 50% brightness.
Examples
MIDI intensities
In MIDI messages, .note_on
intensities are integers in the range [0, 127].
Integer | Hex | Fraction of maximum value |
---|---|---|
127 | 7F | 1 |
64 | 40 | 0.5039370079... |
63 | 3F | 0.4960629921... |
0 | 00 | 0 |
24-bit RGB colors
In 24-bit RGB colors (8 bits per channel), intensities are integers in the range [0, 255].
Integer | Hex | Fraction of maximum value |
---|---|---|
255 | FF | 1 |
128 | 80 | 0.5019607843... |
127 | 7F | 0.4980392157... |
0 | 00 | 0 |
255 is divisible by 5
Fun fact: 0.2, 0.4, 0.6, and 0.8 of 255 can be expressed as integers, because 0.2 * 255 = 51 = 0x33
.