MHB Convert Decimals to Signed 12-Bit Numbers

  • Thread starter Thread starter shamieh
  • Start date Start date
  • Tags Tags
    Numbers
AI Thread Summary
The discussion focuses on converting decimal numbers 73, 1906, -95, and -1630 into signed 12-bit representations using sign and magnitude, 1's complement, and 2's complement formats. For the positive number 73, all three representations are the same: 000001001001. The conversion for 1906 is more complex, with the correct binary representation being 011101110010 for all three formats. The confusion arises from the calculation of powers of 2; the correct breakdown shows that 1906 can be represented by summing the powers of 2: 2^10 (1024), 2^9 (512), 2^8 (256), 2^6 (64), 2^5 (32), 2^4 (16), and 2^1 (2). The discussion emphasizes the importance of accurately identifying the largest powers of 2 that fit into the number during conversion.
shamieh
Messages
538
Reaction score
0
Convert the decimal numbers 73, 1906, -95, and -1630 into signed 12 bit numbers in the following representations:
a) Sign and magnitude
b) 1's complement
c) 2's complement

So 73 is easy. It's positive so I know it starts with 0. so I know that

73: sign and mag = 000001001001, 1s complement = 000001001001, 2's complement = 000001001001 . We know this because $$2^6 + 2^3 + 2^0 = 73.$$

BUT let's say I have

1906. I know the first digit will be 0 because it is positive.

So wouldn't I find the sign and magnitude the same way?

1906 sign and mag =what? Apparently it doesn't work the same way?

they are getting this:

1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? $$2^{11} + 2^{10} + 2^9$$ does NOT equal 1906!
 
Technology news on Phys.org
shamieh said:
1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? $$2^{11} + 2^{10} + 2^9$$ does NOT equal 1906!

Counting from right to left, the 1's in your number correspond to the powers of 2:
$$2^{10} + 2^9 + 2^8+ 2^6 + 2^5 + 2^4 + 2^1=1906$$

To convert 1906 to a binary number you would find the largest power of 2 that fits into it, yielding the first '1'.
Then subtract it and repeat.

The largest power of 2 that fits is $2^{10}=1024$.
That leaves $1906 - 1024 = 882$.
Next largest power of 2 that fits is $2^9=512$.
Leaving $882 - 512 = 370$.
And so on.
 
shamieh said:
1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? $$2^{11} + 2^{10} + 2^9$$ does NOT equal 1906!
How did you come up with $$2^{11} + 2^{10} + 2^9$$ starting from 011101110010?
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...
Back
Top