since Aug 25, 2013

For More

Cows and Likes

Cows

Total received

0

In last 30 days

0

Total given

0

Likes

Total received

0

Received in last 30 days

0

Total given

0

Given in last 30 days

0

Forums and Threads

Scavenger Hunt

Ranch Hand Scavenger Hunt

Greenhorn Scavenger Hunt

Thank you. Your time and expertise is appreciated.

10 years ago

Thank you very much Richard I will start working on that. Can the same be done with cube root as well?

10 years ago

Richard Tookey wrote:So do I take it that by 'binary' file you mean a file containing only the characters '0' and '1' ? If so then that is not what I and most people round here would consider to be a binary file; it is simply a file that contains only the characters '0' and '1' but it is still a text file.

Sorry, no I don't mean that. If I may try another way to explain it:

If I was a computer I would read a file(any file) like this b100101010000000111100100.......(right?) then I take this string of bits, get the square root of it ie Math.sqrt(b1001010100000001111001000101.......) = b101000(not true reflection just for example). I just need to know if one can perform square root or cube root calculations on the raw binary string of bits and if so how does one do it in Java.

Richard Tookey wrote:Other than having this set as a school exercise I can think of no obvious reason to perform this type of manipulation on a file content.

Yes it is a college 2D and 3D project using 1's and 0's but must be from a actual file(small or very big).

Richard Tookey wrote:P.S. What happens if your 'binary' file contains millions of '1' and '0' ? Pretty much all arithmetic operations are going to be very very slow.

Correct that is why I would like to know if it can be done on the raw code of the file. Hope I make sense.

Apology if I take up too much of your time and thank you for your input it has helped to clear up a couple of things for me already.

10 years ago

You've been a great help thank you for your time Henry. Reading up on BigInteger and BigDecimal is definitely going in the right direction. Now I just need to figure out how to get the cube root and square root of a BigInteger or bigDecimal and the powers of them.

10 years ago

Thank you I'll look in to BigInteger thank you. Is there a limit to BigInteger ?

10 years ago

Thank you Henry,

Is it then impossible to do theses calculations with a computer?

Is it then impossible to do theses calculations with a computer?

10 years ago

Not sure if I am doing something wrong but why do I get wrong results in the following code?

I tested in Eclipse Helios and Kepler and both return the same results. I also tested int, long and double also gave the same results. I don't get it.

__Results__

I tested in Eclipse Helios and Kepler and both return the same results. I also tested int, long and double also gave the same results. I don't get it.

10 years ago

Hi Richard,

I guess what I'm trying to find out is for example if one take the number 123456789 and get the square root of it it equals 11111.111060555555

My question is can one do that with binary for example 1=110001, 2=110010, 3=110011, 4=110100, 5=110101, 6=110110, 7=110111, 8=111000, 9=111001.

Add them all together in one string "110001110010110011110100110101110110110111111000111001" then get the square root of it even if it leaves one with a floating number. I'm not really interested in the "res" just need to know how many X*X go in to "110001110010110011110100110101110110110111111000111001" without converting each 1's and 0's to a decimal value which will increase space.

Just looking at the answer and converting it directly without res it should look like this 110001110001110001110001110001(11111 in decimal). But how can I do this with Java.

Thank you for your help.

I guess what I'm trying to find out is for example if one take the number 123456789 and get the square root of it it equals 11111.111060555555

My question is can one do that with binary for example 1=110001, 2=110010, 3=110011, 4=110100, 5=110101, 6=110110, 7=110111, 8=111000, 9=111001.

Add them all together in one string "110001110010110011110100110101110110110111111000111001" then get the square root of it even if it leaves one with a floating number. I'm not really interested in the "res" just need to know how many X*X go in to "110001110010110011110100110101110110110111111000111001" without converting each 1's and 0's to a decimal value which will increase space.

Just looking at the answer and converting it directly without res it should look like this 110001110001110001110001110001(11111 in decimal). But how can I do this with Java.

Thank you for your help.

10 years ago

I am very green in Java(but like it allot) have a bit of experience in VB and help from anyone will be highly appreciated.

I have been pulling out my hair reading forum after forum to try and understand or solve my problem. In short I need to take any file content and mathematically manipulate it for example to get the square root of the file be it in binary or otherwise to be used in a small maths program.

I have played around with the code below and many other ones but just to give you a simple idea what I'm looking for see the code below. I know it is wrong but that is the idea more or less.

Please help me.

I have been pulling out my hair reading forum after forum to try and understand or solve my problem. In short I need to take any file content and mathematically manipulate it for example to get the square root of the file be it in binary or otherwise to be used in a small maths program.

I have played around with the code below and many other ones but just to give you a simple idea what I'm looking for see the code below. I know it is wrong but that is the idea more or less.

Please help me.

10 years ago