zeebo17
- 40
- 0
What is 1/7 in base 2? How would you solve for this?
Thanks!
Thanks!
The conversion of the fraction 1/7 to binary results in the infinite binary expansion of 0.(001), indicating a repeating sequence. The correct method to compute this involves using long division, where the fraction is multiplied by 2 repeatedly, recording a 0 for products less than 1 and a 1 for products greater than 1. The incorrect method of converting the decimal representation of 1/7 (0.142857) directly to binary by removing the decimal is clarified as invalid. For further understanding, refer to the "dec2bin_f()" function in the article on base conversion in PHP using BCMath.
PREREQUISITESMathematicians, computer scientists, software developers, and anyone interested in number base conversions and binary arithmetic.
zeebo17 said:What is 1/7 in base 2? How would you solve for this?
Thanks!
1/111
0.100010111000001001
0.142857
sure but not real interesting.Steve.pf said:wouldn't it be:
Code:1/111
But in decimal form it would be:
Code:0.100010111000001001
I'm not sure if it's the correct answer though. My logic was to take the result of 1/7:
Code:0.142857
remove the decimal (by multiplying it by 1,000,000) then converting that number to binary and then re-placing the decimal.
Is my method correct?
Steve.pf said:wouldn't it be:
Code:1/111