convert 9.75 to base two. there are a quiet few methods of doing it, one of them is really nice! so if you have a method not posted here, by all means post it!
Printable View
convert 9.75 to base two. there are a quiet few methods of doing it, one of them is really nice! so if you have a method not posted here, by all means post it!
1001.1001011
no
/me doesn't know how to represent a decimal in binary.
:o
9.75 = 9 + 3/4
= 8 + 1 + 1/2 + 1/4
= 1001.11
yep right answer. also, 9.75=39/4=100111/100=1001.11 :)
9%2=1
9\2=4
4%2=0
4\2=2
2%2=0
2\2=1
1%2=1
do integer division with radix until you get 1, append the modulo to string
0.75 * 2 = 1.5
0.5 * 2 = 1
0.11
I don't know if this works with other than base 2, multiply with with two until you get 1, if you get more than 1, append 1 in the string, subtract 1 from the result and start over, otherways append 0 to string.
1001.11
The division by 100 was originally done by long division! :D :D
Not many ppl could come up with such an ingenious method! :D
Convert fractions by muliplying by the new Radix.
Convert decimal .375 to binary.
Multiply by two: 0.75
Multiply fractional part by two: 1.50
Multiply fractional part by two: 1.00
Fractional part is zero, you are finished.
Take integer parts of each product in order: .011
If you try the above with a value like .37, you will never get exactly zero for the fractional part because .37 is a never ending binary fraction.
To convert integers, divide by radix and use remainder for the converted digits.
Convert decimal 28 to binary.
28/2 = 14, Remainder zero.
14/2 = 7, Remainder zero
7/2 = 3, remainder one
3/2 = 1 remainder one
1/2 = 0 Remainder one. You are done since quotient is zero.
Take remainders in reverse order: 11100
The above works for converting from any radix to any other, but requires doing arithmetic with some radix other than ten for some conversions. For example.
Octal .32 to decimal (Note that Ten = octal 12)
Ten * .32 (octal arithmetic) = 4.04
Ten * .04 = 0.50
Ten * .50 = 6.2
Ten * .2 = 2.4
Ten * .4 = 5.0
Decimal value is .40625
Use decimal arithmetic to convert back to octal.
Eight * .40625 = 3.25
Eight * .25 = 2.000
Result is octal .32