tags:

views:

623

answers:

3

Is there a way to get the square root of a big integer? I am dealing with numbers that are much too large for int64 to handle so bigint is a must.

I was considering the idea of implementing it myself using the Babylonian method, but want to know if there are any built in functions for this first.

Thanks in advance.

+2  A: 

You can use newton's method on any scalar.

http://en.wikipedia.org/wiki/Newton%27s_method

-- MarkusQ

P.S. See also http://en.wikipedia.org/wiki/Methods_of_computing_square_roots

MarkusQ
I believe Newton's method is aka Babylonian method.
duffymo
Yes, that's what he said he was considering using. When I learned it it was always called Newton's method, so when I read "Babylonian method," think, and retransmit it always comes out as "Newton's method."I have stopped calling CDs "records" though, so there's hope for me.
MarkusQ
It was always Newton's method to me, too. I only recently learned about the alias.
duffymo
A: 

Google for lsqrt

leppie
A: 

Happy Square Root Day to you too :).

I don't think there is built-in in bigint

Can Erten