Data Quantization

When sending or receiving a relatively large value in floating point, there could be a trick to reduce the size of packet. For example, if the character's position x can be only determined between 100 and 200, and simply ignore the accuracy of value below double-digit point, then this value can be sent or received after converting it to a value under 100*100 = 10000 and this can save the value as word(2bytes) not as double(8bytes).

Such trick is called quantization.

This class supports quantization and reverse-quantization.

Proud::CQuantizer q(-10000,10000,65535); // Quantizing a value between -10000 and 10000 by dividing it equally by 65535.
double a = 3423.38274f;
int b = q.Quantize(a); // Quantizing
double c= q.Dequantize(b); // Recover the original value from the quantization.