Bill Allombert on Tue, 17 Nov 2009 18:12:36 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: usqrtsafe isn't |
On Mon, Nov 16, 2009 at 07:50:27PM +0100, Bill Allombert wrote: > On Mon, Nov 16, 2009 at 12:28:19AM -0500, Charles Greathouse wrote: > > In writing a program using the Pari library today I was able to trace > > a problem to usqrtsafe. In particular, > > usqrtsafe(18446744073709551615) = 4294967296 > > but 4294967296^2 = 18446744073709551616 > 18446744073709551615. > > Thanks a lot for reporting this problem! > > The code suppose the error is always by default by actually it is always > by excess, because the conversion to 'double' round to the nearest and > usqrtsafe should round to the lowest. > > The patch below should fix that. I commited this patch as SVN revision 12026. Cheers, Bill.