Re: I cant remember how I did it on the 50g Message #4 Posted by Hal Bitton in Boise on 7 Nov 2007, 2:03 p.m., in response to message #1 by Ken Ratkevich
Hi again Ken,
This method will work, although it can get a bit tedious...
To convert from a binary fraction to a decimal fraction:
Let's use your example of #.011b: Multiply the binary fractional number by the power of 2 necessary to move the point to the right of the rightmost digit. In our case we need to move the point three places to the right, so we multiply by 2^3, which gives us
#11b. Use the calc to convert this to decimal, which yields 3.
Divide this by 2^3 (to remove it) and we get .375 .
Going the other way is essentially the reverse of the above, take your decimal fraction and start multiplying by increasing powers of 2 until it's an integer (just start hitting 2 multiply while keeping count)...in our case .375 becomes an integer (3) after being multiplied by 2^3 (8). Convert to binary and divide by 2^3 by sliding the point three places to the left.
If your decimal fractional number won't convert to a pure integer by multiplying by increasing powers of two (and most won't), you're looking at a repeating binary fractional number. Carry out the powers of 2 multiplication until you feel you have enough accuracy (2^13 seems like a good place to stop). Example:
To convert .6 decimal to binary: .6 ENTER, 2 multiply repeatedly while counting. Stop at 13 reps (2^13). display reads 4915.2. Convert to binary (calc will round off fractional part of number) to get #1001100110011b, divide by 2^13 by sliding point 13 places to the left to get #.1001100110011...b.
You could write subroutines to help with the tedious aspects of this, but I'll leave that to you.
Best regards, Hal
|