J.Pietschmann wrote:

Mark R. Diggory wrote:

J.Pietschmann wrote:

No. If you cast the base into a double there is not much risk of
overflow: double x = n;  y=x*x; or y=((double)n)*((double)n);
or even y=n*(double)n; (but avoid y=(double)n*n).
Double mantissa has IIRC 52 bits, this should be good for integers
up to 2^26=67108864 without loss of precision.


Is this correct, I've been reading (again, if I'm getting this correctly) the doubles mantissa is capable of supporting 15 -17 decimal places, 2^26 is only 8.


I meant: you can square integers up to 2^26 without loss of precision
(due to truncation).

J.Pietschmann

Yes I do agree with you on that one.



-- Mark Diggory Software Developer Harvard MIT Data Center http://www.hmdc.harvard.edu



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to