az1981cn
2019-09-09, 19:25
T.F = fimath('SumMode','SpecifyPrecision', 'SumWordLength', 10, 'SumFractionLength', 4);
a=fi(-32,1,10,4,T.F)
b=fi(-1.5,1,10,4,T.F)
c=fi(-25.9375,1,10,4,T.F)
d=fi(9,1,10,4,T.F)
K>> a+b+c+d
ans =
-23
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 10
FractionLength: 4
RoundingMethod: Nearest
OverflowAction: Saturate
ProductMode: FullPrecision
SumMode: SpecifyPrecision
SumWordLength: 10
SumFractionLength: 4
CastBeforeSum: true
为什么输出结果是-23,而不是-32呢?
a=fi(-32,1,10,4,T.F)
b=fi(-1.5,1,10,4,T.F)
c=fi(-25.9375,1,10,4,T.F)
d=fi(9,1,10,4,T.F)
K>> a+b+c+d
ans =
-23
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 10
FractionLength: 4
RoundingMethod: Nearest
OverflowAction: Saturate
ProductMode: FullPrecision
SumMode: SpecifyPrecision
SumWordLength: 10
SumFractionLength: 4
CastBeforeSum: true
为什么输出结果是-23,而不是-32呢?