Fixed-Point Blockset |
 |
Example: Fixed-Point Scaling
Range of an 8-Bit Fixed-Point Data Type -- Radix Point-Only Scaling
The precision, range of signed values, and range of unsigned values for an 8-bit generalized fixed-point data type with radix point-only scaling follow. Note that the first scaling value (21) represents a radix point that is not contiguous with the word.
Scaling
|
Precision
|
Range of Signed Values (low, high)
|
Range of Unsigned Values (low, high)
|
21
|
2.0
|
-256, 254
|
0, 510
|
20
|
1.0
|
-128, 127
|
0, 255
|
2-1
|
0.5
|
-64, 63.5
|
0, 127.5
|
2-2
|
0.25
|
-32, 31.75
|
0, 63.75
|
2-3
|
0.125
|
-16, 15.875
|
0, 31.875
|
2-4
|
0.0625
|
-8, 7.9375
|
0, 15.9375
|
2-5
|
0.03125
|
-4, 3.96875
|
0, 7.96875
|
2-6
|
0.015625
|
-2, 1.984375
|
0, 3.984375
|
2-7
|
0.0078125
|
-1, 0.9921875
|
0, 1.9921875
|
2-8
|
0.00390625
|
-0.5, 0.49609375
|
0, 0.99609375
|
Range of an 8-Bit Fixed-Point Data Type - [Slope Bias] Scaling
The precision and range of signed and unsigned values for an 8-bit fixed-point data type using [Slope Bias] scaling follow. The slope starts at a value of 1.25 and the bias is 1.0 for all slopes. Note that the slope is the same as the precision.
Bias
|
Slope/Precision
|
Range of Signed Values (low, high)
|
Range of Unsigned Values (low, high)
|
1
|
1.25
|
-159, 159.75
|
1, 319.75
|
1
|
0.625
|
-79, 80.375
|
1, 160.375
|
1
|
0.3125
|
-39, 40.6875
|
1, 80.6875
|
1
|
0.15625
|
-19, 20.84375
|
1, 40.84375
|
1
|
0.078125
|
-9, 10.921875
|
1, 20.921875
|
1
|
0.0390625
|
-4, 5.9609375
|
1, 10.9609375
|
1
|
0.01953125
|
-1.5, 3.48046875
|
1, 5.98046875
|
1
|
0.009765625
|
-0.25, 2.240234375
|
1, 3.490234375
|
1
|
0.0048828125
|
0.375, 1.6201171875
|
1, 2.2451171875
|
| Range and Precision | | Example: Constant Scaling for Best Precision |  |