[Michael Hudson] > ... > Having ddd.ddd be a rational bothers me. *No* langauge does that at > present, do they? ABC (Python's closest predecessor) did. 6.02e23 and 1.073242e-301 were also exact rationals. *All* numeric literals were. This explains why they aren't in Python, but doesn't explain exactly why: i.e., it didn't work well in ABC, but it's unclear whether that's because rationals suck, or because you got rationals even when 10,000 years of computer history <wink> told you that "." would get you something else. > Also, writing rational numbers as decimal floats strikes me as a > bit loopy. Is > > 0.33333333 > > 1/3 or 3333333/10000000? Neither, it's 33333333/100000000 (which is what I expect you intended for your 2nd choice). Else 0.33333333 == 33333333/100000000 would be false, and 0.33333333 * 3 == 1 would be true, and those are absurd if both sides are taken as rational notations. OTOH, it's possible to do rational<->string conversion with an extended notation for "repeating decimals", e.g. str(1/3) == "0.(3)" eval("0.(3)") == 1/3 would be possible (indeed, I've implemented it in my own rational classes, but not by default since identifying "the repeating part" in rat->string can take space proportional to the magnitude of the denominator). but-"."-is-mnemonic-for-the-"point"-in-"floating-point"-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4