Question about representation of numbers in different bases

Click For Summary
SUMMARY

The discussion centers on the representation of real numbers in different bases, specifically addressing how to handle negative numbers. It confirms that if X is the representation of a in base B and Y is the representation of b in the same base, then X + Y equals a + b. The binary expansion of negative numbers can be achieved by separating the integer and fractional parts, converting them individually, and applying the appropriate sign. The use of "2's complement" is highlighted as a common method for representing negative numbers in computing.

PREREQUISITES
  • Understanding of number bases (binary, decimal, etc.)
  • Familiarity with binary expansion algorithms
  • Knowledge of "2's complement" representation
  • Basic arithmetic operations in different bases
NEXT STEPS
  • Learn how to convert negative decimal numbers to binary using "2's complement".
  • Research algorithms for binary expansion of fractional numbers.
  • Explore the implications of different base representations in computer science.
  • Study the mathematical properties of addition in various number bases.
USEFUL FOR

Mathematicians, computer scientists, software developers, and anyone interested in numerical representation and base conversions.

Arian.D
Messages
101
Reaction score
0
I'm thinking of expanding the numerical value of a real number in different bases. I want you guys to ensure some things for me so I know I'm not wrong.

If X is the representation of a in the base B and Y is the representation of b in the same base(radix), can we say that X+Y = a+b?

In particular I wonder if I can evalute the binary expansion of -4.125 in the following way:
First I write -4.125 = -5 + 0.875, then I find the binary expansion of -5, to do that first I see that 5 = (101)2 and then I add the minus sign to it. Right?
Now I find the binary expansion of 0.875, which is easy because I have an algorithm that gives me the binary expansion of any positive real number less than one.

All I have said is easily generalized to other bases. But the question is, how should I expand negative numbers in a bases? How do I expand -4.625 in base-10 for example?
I'm confused.
 
Mathematics news on Phys.org
I'm not sure why you would think you'd need to "expand" -4.625 in base 10. It's...already written in base 10. -4 - 6/10 - 2/100 - 5/1000. That's what decimals mean.

Similarly, you could take -4.125 and just recursively divide it by 2, keeping track of how many times you've done so, until you get a number smaller in magnitude than 1. Take that result, shunt it into your algorithm that finds the binary expansion of any number less than 1, tack on the minus sign if needed and a 0 on the end for each time you had to divide by 2. This repeated dividing by 2 just moved the "decimal point" (but remember, it's still binary) of the number until you got something smaller than 1.
 
Arian.D said:
If X is the representation of a in the base B and Y is the representation of b in the same base(radix), can we say that X+Y = a+b?
Addition of numbers in a given representation is defined to be the mechanical procedure that gives the right result, so by definition, yes.
But the question is, how should I expand negative numbers in a bases? How do I expand -4.625 in base-10 for example?
Representation of negative numbers can be done with a minus sign in any base.
There are other possible representations. Computers mostly use "2's complement". If you wanted to get really confused you could adopt this in written form e.g. by defining that the leading digit is negative, the rest positive. -4.625 would be written 5.375 (-5 + 0.375). All positive numbers would be written with a leading zero (as in "2's complement"). Addition would proceed thus: 5.375 + 0.813 = 4.188.
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
933
  • · Replies 2 ·
Replies
2
Views
2K