Hi,
if you only specify the word length and not the fraction length you get two different objects:
>> fi(0.25, 0, 16)
ans =
0.2500
DataTypeMode: Fixed-point: binary point scaling
Signedness: Unsigned
WordLength: 16
FractionLength: 17
>> fi(0.5, 0, 16)
ans =
0.5000
DataTypeMode: Fixed-point: binary point scaling
Signedness: Unsigned
WordLength: 16
FractionLength: 16
Note the difference on the FractionLength.
Now if you want to have numbers between 0 and 1, so FractionLength 16, you get what I think you are looking for:
>> bin(fi(0.5, 0, 16, 16))
ans =
1000000000000000
>> bin(fi(0.25, 0, 16, 16))
ans =
0100000000000000
Titus
Best Answer