News for hackers. Stuff that matters.
Re:0.30000000000000004 by Nemi on Friday November 13, 2015 @11:28AM (#10560653)
So, this is a great explanation. I have never heard it expressed this way and I love it.

However, I am a little confused. In your first paragraph you say that 10's prime factors are 5 and 2, so 1/10 can be expressed cleanly. In paragraph two you say that binary only has a prime factor of 2, but 10 is divisible by 2, so why doesn't 1/10 express cleanly in binary?

Re:0.30000000000000004 by such_a_casual on Friday November 13, 2015 @11:34AM (#10560695)
In the fraction 1/10, the denominator is 10. The prime factors of 10 are 2 and 5.

Binary does not contain the prime factor of 5 necessary to represent 1/10 cleanly as a decimal. It only contains the 2.

Similarly, the prime factors for 1/6 would be 3 and 2. In a base 10 number system, you only have the 2. So you end up with a repeating decimal (0.1666666).

Re:0.30000000000000004 by aeorgnoieang on Friday November 13, 2015 @11:33AM (#10560685)
A fraction can only be expressed 'cleanly' if its denominator uses only the prime factors of the base.
Re:0.30000000000000004 by btilly on Friday November 13, 2015 @02:16PM (#10561815)
For example, 30 is divisible by 10, but 1/30 is not represented cleanly in base 10.