answersLogoWhite

0


Best Answer

The number 1234.456 is a real number, as opposed to an integer or whole number. Converting a real number to a binary number can only be achieved when the real number is an exact power of 2. Unfortunately, 1234.456 is not an exact power of 2 and therefore cannot be accurately converted to binary.

Converting integers to binaryThe integer portion, 1234, is easily dealt with as all decimal integers can be represented accurately in binary. We convert the integer portion to its binary equivalent by repeatedly dividing by 2 and placing the remainder (which can only be 0 or 1) in right-to-left order (least-significant to most-significant).

So we have:

  • 1234 ÷ 2 = 617, remainder 0 (least-significant digit)
  • 617 ÷ 2 = 308, remainder 1
  • 308 ÷ 2 = 154, remainder 0
  • 154 ÷ 2 = 77, remainder 0
  • 77 ÷ 2 = 38, remainder 1
  • 38 ÷ 2 = 19, remainder 0
  • 19 ÷ 2 = 9, remainder 1
  • 9 ÷ 2 = 4, remainder 1
  • 4 ÷ 2 = 2, remainder 0
  • 2 ÷ 2 = 1, remainder 0
  • 1 ÷ 2 = 0, remainder 1 (most-significant digit)

Therefore 1234 in binary is:

100110100102

Converting fractions to binary

The fractional portion is not so easily dealt with because 0.456 is not an exact power of 2. To understand why, consider that the digits following a decimal point represent decreasing powers of 10; tenths, hundredths, thousandths, and so on. In other words, 0.45610 means four tenths, five hundredths and six thousandths in decimal.

But in binary, the digits following a binary point are decreasing powers of 2. Thus the first digit after a binary point represents halves, the next represents quarters, then eighths, sixteenths, and so on. Therefore a binary number such as 0.112 means three quarters (a half plus a quarter), or 0.75 in decimal.

If we attempt to convert .45610 into binary, we will get this far:

0.0111010010111100011010100111111011111001110110110010001011010000111001010110000001000001100010010011...2

The binary digits will begin to repeat into infinity at this point. This is not unlike trying to represent an irrational number like a third in decimal: 0.333...

To demonstrate this more clearly, let's work it out one step at a time. We begin with 0.456 and multiply by 2. If the result is greater than 1, we place a 1 after the binary point and subtract 1 from the result, otherwise we place a zero after the binary point. We then multiply the result by 2 and repeat until the result is zero.

Thus we have:

  • 0.456 x 2 = 0.912
  • 0.912 x 2 = 1.824
  • 0.824 x 2 = 1.648
  • 0.648 x 2 = 1.296
  • 0.296 x 2 = 0.592
  • 0.592 x 2 = 1.184
  • 0.184 x 2 = 0.368
  • 0.368 x 2 = 0.736
  • 0.736 x 2 = 1.472
  • 0.472 x 2 = 0.944
  • 0.944 x 2 = 1.888
  • 0.888 x 2 = 1.776
  • 0.776 x 2 = 1.552
  • 0.552 x 2 = 1.104
  • 0.104 x 2 = 0.208
  • 0.208 x 2 = 0.416
  • 0.416 x 2 = 0.832
  • 0.832 x 2 = 1.664
  • 0.664 x 2 = 1.328
  • 0.328 x 2 = 0.656
  • 0.656 x 2 = 1.312
  • 0.312 x 2 = 0.624
  • 0.624 x 2 = 1.248
  • 0.248 x 2 = 0.496
  • 0.496 x 2 = 0.992
  • 0.992 x 2 = 1.984
  • 0.984 x 2 = 1.968
  • 0.968 x 2 = 1.936
  • 0.936 x 2 = 1.872
  • 0.872 x 2 = 1.744
  • 0.744 x 2 = 1.488
  • 0.488 x 2 = 0.976
  • 0.976 x 2 = 1.952
  • 0.952 x 2 = 1.904
  • 0.904 x 2 = 1.808
  • 0.808 x 2 = 1.616
  • 0.616 x 2 = 1.232
  • 0.232 x 2 = 0.464
  • 0.464 x 2 = 0.928
  • 0.928 x 2 = 1.856
  • 0.856 x 2 = 1.712
  • 0.712 x 2 = 1.424
  • 0.424 x 2 = 0.848
  • 0.848 x 2 = 1.696
  • 0.696 x 2 = 1.392
  • 0.392 x 2 = 0.784
  • 0.784 x 2 = 1.568
  • 0.568 x 2 = 1.136
  • 0.136 x 2 = 0.272
  • 0.272 x 2 = 0.544
  • 0.544 x 2 = 1.088
  • 0.088 x 2 = 0.176
  • 0.176 x 2 = 0.352
  • 0.352 x 2 = 0.704
  • 0.704 x 2 = 1.408
  • 0.408 x 2 = 0.816
  • 0.816 x 2 = 1.632
  • 0.632 x 2 = 1.264
  • 0.264 x 2 = 0.528
  • 0.528 x 2 = 1.056
  • 0.056 x 2 = 0.112
  • 0.112 x 2 = 0.224
  • 0.224 x 2 = 0.448
  • 0.448 x 2 = 0.896
  • 0.896 x 2 = 1.792
  • 0.792 x 2 = 1.584
  • 0.584 x 2 = 1.168
  • 0.168 x 2 = 0.336
  • 0.336 x 2 = 0.672
  • 0.672 x 2 = 1.344
  • 0.344 x 2 = 0.688
  • 0.688 x 2 = 1.376
  • 0.376 x 2 = 0.752
  • 0.752 x 2 = 1.504
  • 0.504 x 2 = 1.008
  • 0.008 x 2 = 0.016
  • 0.016 x 2 = 0.032
  • 0.032 x 2 = 0.064
  • 0.064 x 2 = 0.128
  • 0.128 x 2 = 0.256
  • 0.256 x 2 = 0.512
  • 0.512 x 2 = 1.024
  • 0.024 x 2 = 0.048
  • 0.048 x 2 = 0.096
  • 0.096 x 2 = 0.192
  • 0.192 x 2 = 0.384
  • 0.384 x 2 = 0.768
  • 0.768 x 2 = 1.536
  • 0.536 x 2 = 1.072
  • 0.072 x 2 = 0.144
  • 0.144 x 2 = 0.288
  • 0.288 x 2 = 0.576
  • 0.576 x 2 = 1.152
  • 0.152 x 2 = 0.304
  • 0.304 x 2 = 0.608
  • 0.608 x 2 = 1.216
  • 0.216 x 2 = 0.432
  • 0.432 x 2 = 0.864
  • 0.864 x 2 = 1.728
  • 0.728 x 2 = 1.456
  • 0.456 ...

And we're back where we started.

In order to represent 1234.45610 in binary, we must use an approximation (just as 0.333 is an approximation for a third in decimal). The precision will depend on how many significant digits we wish to expose. If we allow 32-digit precision, then we can say that .45610 in binary is approximately:

0.011101001011110001101010011111102

Thus we can say that 1234.45610 in binary is (approximately):

10011010010.011101001011110001101010011111102

Converting binary to octal

To convert to octal, we simply group these binary digits into groups of three digits each (padding with a leading and trailing zeroes if necessary) and convert them to their decimal equivalent (which will always be digit in the range 0 to 7).

  • 010 = 2 (leading zero added)
  • 011 = 3
  • 010 = 2
  • 010 = 2
  • .
  • 011 = 3
  • 101 = 5
  • 001 = 1
  • 011 = 3
  • 110 = 6
  • 001 = 1
  • 101 = 5
  • 010 = 2
  • 011 = 3
  • 111 = 7
  • 100 = 4 (trailing zero added)

Thus 1234.456 in octal is (approximately):

2322.351361523748

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you convert 1234.465 into binary and to octal?
Write your answer...
Submit
Still have questions?
magnify glass
imp