The basic way of doing it with pencil and paper.
# Write down "0." (i.e. "zero point") # Start with n=-1 and your number x # If 2^n > x, then decrement n, and write down a "0". Keep repeating until 2^n < x. # Let x = x - 2^n, and decrement n. # If x is 0, you're done. Otherwise, return to step 3. Here's an infinite example, converting 0.7 to a decimal
# At step 1. We have written down "0." # At step 2. n=-1, x=0.7. # At step 3. 2^-1 = 0.5, which is less than x (now 0.7)
# At step 4. Let x = 0.7 - 0.5 = 0.2. Decrement n to -2. We have written down "0.1" # At step 5. x is not 0, so we return to step 3. # At step 3. 2^-2 = 0.25, which is greater than x (now 0.2). Decrement n to -3. We have written down "0.10"
# At step 3. 2^-3 = 0.125, which is less than x (now 0.2). # At step 4. Let x = 0.2 - 0.125 = 0.075. Decrement n to -4. We have written down "0.101". # At step 5. x is not 0, so we return to step 3. # At step 3. 2^-4 = 0.0625, which is less than x (now 0.075). # At step 4. Let x = 0.075 - 0.0625 = 0.0125. Decrement n to -5. We have written down "0.1011". # At step 5. x is not 0, so we return to step 3. # At step 3. 2^-5 = 0.03125, which is greater than x (now 0.0125). Decrement n to -6. We have written down "0.10110". # At step 3. 2^-6 = 0.015625, which is still greater than x. Decrement n to -7. We have written down "0.101100". # At step 3. 2^-7 = 0.0078125, which is less than x (now 0.0125). # At step 4. Let x = 0.0125 - 0.0078125 = 0.0046875. Decrement n to -8. We have written down "0.1011001". # At step 5. x is not 0, so we return to step 3. # Et cetera ad nauseum
Chat with our AI personalities
The simplest way to convert a fraction to a decimal is to get the denominator to equal 100. To do this, simply divide 100 by the denominator you have, e.g. 17/20 so you would divide 100 by 20 giving you an answer of 5. You now multiply the numerator and the denominator by 5, so you would end up with 85/100. The decimal would therefore be 0.85.
Although, in fractions this symbol, / , simply means divide. So you could use your calculator to figure out say 61/73 (61 divided by 73), which the answer would be 0.835616438 etc.
Hope that helped.
Converting from binary to decimal:
1. Write the binary digits in a column, least-significant bit first. Thus 10110100 would be written:
0 < least-significant bit
0
1
0
1
0
1
1 < most-significant bit
2. Multiply each digit by increasing powers of 2, starting with 2^0:
0 x 2^0 = 0 0 x 2^1 = 0
1 x 2^2 = 4
0 x 2^3 = 0
1 x 2^4 = 16
0 x 2^5 = 0
1 x 2^6 = 64
1 x 2^7 = 128
3. Sum the products:
128 + 64 + 0 + 16 + 0 + 4 + 0 + 0 = 212
Thus 10110100 binary is 212 decimal.
To reverse the process, repeatedly divide by 2 and take the remainder. Thus to convert 212 decimal to binary:
212 / 2 = 106 r 0
106 / 2 = 53 r 0
53 / 2 = 26 r 1
26 / 2 = 13 r 0
13 / 2 = 6 r 1
6 / 2 = 3 r 0
3 / 2 = 1 r 1
1 / 2 = 0 r 1
Read the remainders in reverse order (bottom up): 11010100
write the binary number
just below binary number digit write their place value such as 1,2,4,8,16,32,64......... starting from right to left.
in case zero appears in the last position , ignore the decimal value for that position
to get decimal equivalent add the remaining weights.
for example 111.101
Binary number 1 1 1 . 1 0 1
Place value of
decimal position 22 21 20 . 2-1 2-2 2-3
4 2 1 1/2 1/4 1/8
First forgot negative sign and convert decimal number to binary and then make it's 2's compliment. It will give you exactly binary number of that negative decimal number.
k n o w ? First convert it to ASCII code ... 107 110 111 119 (all decimal numbers) Then convert to binary : 1101011 1101110 1101111 1110111
write a c++ program to convert binary number to decimal number by using while statement
All I know is that when a number is negative, you convert the decimal into binary and if it is negative you put 1111 before the binary digits.
Write algorithms and draw a corresponding flow chart to convert a decimal number to binary equivalent?
It is a decade counter with a binary to decimal translator meaning it can take binary and turn it into decimal numbers for example a seven segment display