|
|
|
|
 浮点模拟 - EricFisher [ 2006-01-20 15:08 | 243 byte(s)]
 Re: 浮点模拟 - EricFisher [ 2006-01-23 09:29 | 1,316 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
1、有谁知道gcc的浮点模拟代码fp-bit.c中,NGARDS,IMPLICIT_1这两个宏什么意思?
2、unpack_d函数最后的代码,dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1;什么意思?
谢谢!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
> I guess that the macro NGARDS is relevant to the guard digit. But I
> still failed to have a clear conception about what it means. Others
> are easy to know by IEEE 754 and "What Every Computer Scientist Should
> Know about Floating-Point Arithmetic". Except,
>
> define NGARDS 8L
> define GARDROUND 0x7f
> define GARDMASK 0xff
> define GARDMSB 0x80
>
> what do these mean? :-)
NGARDS is the number of guard bits--as I recall you need at least two
guard bits, and beyond that fp-bit just fills out to the next byte
boundary. GARDROUND is a mask for the bits - 1, GARDMASK is a mask
for the bits, GARDMSB is the most significant guard bit.
> Especially when unpack a signal floating point, the fraction takes
> such an operation at last, that make me much confused.
> dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1;
The left shift makes room for the guard bits. The IMPLICIT_1 is the
implicit 1 found in the IEEE-754 floating point mantissa.
Ian
|
|
|
[Original]
[Print]
[Top]
|
|
|