Okay, so I am using the BigInteger java class, because a long value would be less than 64 bytes, to store a value. I am trying to find the square root of it. I don't really understand the formula for using a square root. Please help.
Google, Google, Google. And a million times Google. The Newton-Raphson is something that you might look into, for starters. (I see that builderboy's page already mentions it.) Another fun thing to try is to have the computer play an optimal game of "guess the number" with itself in order to home in on the positive number that, when multiplied by itself, equals the input. (This is otherwise known as the bisection method.)
As long as you're groping for answers, I might as well introduce this thread I found.
EDIT: Oh ho, so BigInteger doesn't support decimals. However, I'm seeing a lot of programs that convert the number before processing it. Is that unacceptable?
Okay, the problem I had was two fold. The first was, that I was using big integer, and naively believing that it would magically turn into a decimal. The second problem was the fact that I figured it would compute the digits until the end of time, but apparently, it won't. lol
I googled forever, but I am not that smart to figure out all of that, and I have no calculus, until next week. Joy… (Is it hard? I have pre-calculus.)
EDIT: I realized the problem now. It is a problem when trying to convert it back. Let's see how it does with a really big number.
EDIT2: I converted it back to a BigInteger, and it had a bunch of zeros, so I changed the precision to 128, and it works great. Is there any way to check it? I just want to make sure it is right.
I converted it back to a BigInteger, and it had a bunch of zeros, so I changed the precision to 128, and it works great. Is there any way to check it? I just want to make sure it is right.
try your calculator :P, or if the number is too big, try microsoft calculator.
512 bits… Not quite gonna fit into there. Anyway, I squared it back, and it was less than the original number, so I added one to the root, and it was greater, so I now have my floor and my ceiling to check. The problem is right now, that I can't figure out the Quadratic Sieve. Oh well, for now it's working. Thanks everyone!!!
TI Interactive will let you calculate big numbers.
Find more info about my projects on Omnimaga:
try this: http://ohdave.com/rsa/
Um, thats an encryption/decryption websight. I don't see anything to do with square roots
i dont know… the numbers in java?