On Sunday 29 October 2006 17:58, david eddy wrote:
> John Pierce wrote:
> > the FP numbers used are double precision (64 bit) which have ~48 bits of
> > mantissa
Exactly: 53 bit mantissa + 11 bit exponent (the most significant bit of the
mantissa
is known to be 1 so we squeeze in the sign bit "for free"), unless you're
still using the non-SSE2 code, in which case the internal FP register format
is 64 bit mantissa + 15 bit exponent + 1 bit non-explicit sign. The extra
precision of the "traditional" x86 10-byte float allows slightly larger
crossover points to be used, even though we have to convert between 80-bit
and 64-bit ("G" float) rather more often than is desireable.
> > , so the 1 million bit FFT size is, I believe, broken into 48
> > bit chunks, about 21000 of them?
Well - we need to represent the square in there, and also we need a few guard
bits, so typically we'd want to use about 20 bits per FFT element. Also,
there are p bits altogether, so it's fairly obvious that not all elements
have the same number of bits encoded within them...
The number of FFT elements in prime95/mprime is always an exact power of 2, or
3, 5 or 7 times an exact power of 2. Other multipliers are possible but the
extra cost of processing "carries" tends to make the added complication not
really worth the effort.
>
> Representing a 48 bit integer in double precision FP is one thing.
48 bits is going to be dangerous....
>
> Putting it through the FFT mill and getting an exact 48 bit integer is
> IMHO quite another:)
Well it might happen. However only 5 guard bits is not in general going to be
safe. Theoretically we'd expect the _average_ (root-mean-square) element
error to be approx. 0.5 * log(base 2)(run length) bits. We should have _at
least_ a couple more guard bits than that to be reasonably secure that we're
hitting the right integer when we round up or down to the nearest. That's
assuming that the DWT tricks which allow us to save lots of memory &
processing time don't have any effect on the precision, which I think they
must do to some extent.
Regards
Brian Beesley
_______________________________________________
Prime mailing list
[email protected]
http://hogranch.com/mailman/listinfo/prime