Its pseudo code, and for n < 2 (or... n = 1 in an array starting at 1) then you just eliminate the final portion asking for n - 1 and just XOR the two values, AKA just do the first portion of the giant bool statement
I would work it out... but it's a lot of typing out of 0's and 1's... so let me just ask you, does it work for floating point arithmetic?
Write a program to compute and print the sum of salaries of all emp in each department like
Dev-13000
Acc-1100.
... Why are we doing this exactly? Who are you and what is the purpose of this program? We are not supposed to do your homework for you, check the forum guidelines. If that is not the case I apologize.
This program though is not hard at all utilizing string's .split(String delimiter) method. Look it up in java's documentation on class String.
Should, you would just have two numbers, one that directly influences the second.
IE:
1001 . 1101 = 9.13
if the second half became greater than 100, you subract 100 and add 0001 to the first one as you normally would.
EDIT: If you want more precision, the value you wait to subract from increases (1000, 10000, etc)
But floating point numbers aren't stored this way, they are stored as a sign bit, exponent bits, and mantissa bits as I explained above. Are you saying that to use this method we should first convert them to a new form of storing floating point numbers which has a number of bits before a decimal and a number of bits after a decimal?
Please correct me if I'm wrong and please excuse my ignorance since I'm new to this subject.
You asked how I would go about doing it without + or -, and I just gave an example of how to do it. I havent really ever looked at the bit structure of a floating point number, so I couldnt give you a good example until I researched it. The method I gave above just pretends either side of the decimel is an integer. I would imagine that a floating point number looks something like:
You asked how I would go about doing it without + or -, and I just gave an example of how to do it. I havent really ever looked at the bit structure of a floating point number, so I couldnt give you a good example until I researched it. The method I gave above just pretends either side of the decimel is an integer. I would imagine that a floating point number looks something like:
Decimel location Left hand value Right hand value
Check the 'index' article in the Java Articles section. Near the bottom there's a
link that reads 'What every computer scientist should know about floating point
arithmetic'. Read it; it pays back.
Comment