# How to correctly scale integers between intervals?

Advertisements I have uint16_t integers in the range [ 0 .. 4092 ] and I need to scale them into [ 0 .. 255 ] interval. What’s the correct formula for that? The obvious one y = x * 255 / 4092 doesn’t work because the scaling factor is 15.988 so I need 15-16 (usually… Read More How to correctly scale integers between intervals?