3 ms·
You theoretically shouldn't even have to be a computer scientist. A standard mathematical education ought to teach you that for any given base, the only numbers
by jerf 16y ago
You theoretically shouldn't even have to be a computer scientist. A standard mathematical education ought to teach you that for any given base, the only numbers that can be represented in that base exactly are numbers where the prime factorization of the denominator contains only prime numbers that are also contained in the prime factorization of the base itself, or is simply 1 for integers. Base 10 has 2 and 5. .2 is 1/5, so it's precise. .5 is 1/2, so it's precise. 1/12 has 2 2s in it, which works, and a 3, which doesn't, so 1/12 is recurring.
But prime factorization seems to be taught for almost superstitious reasons, as some sort of math trick rather than a fundamental aspect of understanding numbers at even the most basic of levels, with neither students nor teachers nor the curriculum writers really understanding why this is in the lesson plan, so, yeah, I suppose you have to be some sort of super expert genius to swiftly realize that 1/3 can't be represented in a base-2 number. But it shouldn't be that way.
- jrockway 16y agoI think the connection that "computer numbers are base 2" is what's missing. You input them into the computer in base 10, and they are printed in base 10. The base 10 representation is wrong because information was lost when converting to a fixed-width base 2 number. But that is hidden by the compiler or program, so it confuses programmers and users. It works in Excel...
- caf 16y agoExcel does "cosmetic" rounding, that ends up producing some surprising results - in the words of this author, it "confers supernatural powers upon some (not all) parentheses": http://www.cs.berkeley.edu/~wkahan/Mindless.pdf http://www.cs.berkeley.edu/~wkahan/Mindless.pdf