Answered # Differentiate between +ve and -ve binary numbers.

Labdabeta 182 Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...

3

It is completely situational. Here is an example:

1000001

What is that number?

If you interpret it as a 7-bit unsigned number you get 65.

If you interpret it as a 7-bit sign/magnitude number you get -1.

If you interpret it as 1's complement you get -63.

If you interpret it as 2's complement you get -64.

If you interpret it as 8-bit 2's complement (very common) you get 65.

If you interpret it as an ASCII character you get 'A'.

If you interpret it as BCD (binary coded decimal) you get 41.

Basically you can represent anything which is countable using only 1s and 0s, and similarly every set of 1s and 0s can represent any number of things. The only way to know which interpretation to use is by situation.

In any given assembly language they will usually tell you exactly what things mean. Incidentally, once you assemble your code in assembly it will be turned into another number. For example in MIPS assembly (as described by my professor) you have:

add $1,$2,$3 = 0000 0000 0100 0011 0000 1000 0010 0000

The key is that n bits can represent 2^n possible 'thing's you need to define what 'thing' you want them to represent. In the case of 1s or 2s complement you just look at the first bit, if it is 1 the number is negative:

1011 in 4 bit 2's complement = -5

1011 in 8 bit 2's complement is 0000 1011 = 11

If you are interested in the topic of representing information I suggest you do some research on information theory, an entire branch of mathematics/computer science devoted to representing, measuring and transmitting information.

*Edited 3 Years Ago by Labdabeta*

This question has already been answered. Start a new discussion instead.

Recommended Articles

Hello All ...

Iam Getting An Error With try to excecute the stored procedure .

I have Have Sql database , the stored procedure like so :

```
USE [MPRS]
GO
/****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE ...
```

Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"

Here is the sample output that I ...