4 ms·
https://0.30000000000000004.com/ https://0.30000000000000004.com/
by latchkey 7y ago
https://0.30000000000000004.com/ https://0.30000000000000004.com/
- TekMol 7y agoComputers can only natively store integers, so they need some way of representing decimal numbers. Really? How do computers "natively" store integers?
- tyingq 7y agoIt seems to just be layman shorthand for storing (not huge) integers as binary isn't lossy.
- Dylan16807 7y agoStoring integers as decimal (which computers can do easily) isn't lossy either.
- viraptor 7y agoI believe that's where "natively" comes in. If you store it in binary, you can operate on the values as numbers. If you do some decimal conversion, it's a blob of data. (Yes, there are BCD instructions but they're massively limited)
- SmellyGeekBoy 7y agoDecimal numbers are still "stored as binary" at the silicon level.
- mondoshawan 7y agoUnless you're on an IBM 1401... :D
- Merrill 7y agoz14 and Power 9 appear to support decimal integer and float. Does Python on those processors support their use?
- tyingq 7y agoI meant as opposed to floats, precision loss, etc.
- mumblemumble 7y agoThe intent of that sentence is a lot clearer if you also consider the subsequent text, which expands on the idea quite a bit: > Computers can only natively store integers, so they need some way of representing decimal numbers. This representation comes with some degree of inaccuracy. . . Why does this happen? It's actually pretty simple. When you have a base 10 system (like ours), it can only express fractions that use a prime factor of the base. . . Perhaps a more formally correct way to put it is that integers (and natural numbers) are the only numbers that a computer can manage in a way that behaves reasonably similarly to the corresponding mathematic set. Specifically, as long as you stick to their numeric range, computer ints behave like a group, just like real integers do. But IEEE floats break the definition of a field in every which way, so they're really not a great match for the rationals. That said, you could represent the rationals as a pair of integers, and that would be better-behaved, and some programming languages do do that. But I'm not aware of an ISA that supports it directly.
- bregma 7y agoMaybe you need to parse "decimal numbers" as "fractional numbers" rather than "expressed using a radix of 10". Perhaps it would be better phrased as "computers can only store whole numbers, so they need some way to represent other information, including integers, rational numbers and approximations to complex numbers."
- moring 7y agoSomewhat offtopic, but is there a reason some many explanations of this issue lump together the fundamental principle of how numbers are represented (integers vs. fractions vs. exact reals (technically impossible) vs. IEEE 754) and the base (decimal vs. binary)? Every time I read something like the explanation on that site, I wonder if I would understand it if I didn't knew it already.
- mumblemumble 7y agoThe "why does this happen" on that page hits on it, at least tangentially. A lot of what's confusing about IEEE floats isn't the inability to represent all rationals in and of itself, it's more that the particular patterns of inaccuracy end up being different between the computer approximation and the approximations we'd make on paper, because of the different numeric bases.
- ben509 7y agoRelated to that problem, a major source of confusion with IEEE floats is that languages go to great lengths[1] to present them as decimals and hide the underlying binary denominator. Even when you know they're binary internally, it throws you off. High level languages are also annoying in that they don't provide great support for working with them as binary denominated rationals, e.g. there's no round_base2 in python, and there's no hex float representation in printf. [1]: https://news.ycombinator.com/item?id=10915182 https://news.ycombinator.com/item?id=10915182
- mark-r 7y agoPython doesn't support hex float in printf, but it does give you an easy way to do the conversion: x.hex()
- mark-r 7y agoThe difference between decimal and binary is essential to understanding the problem. Just as there's no elegant way to represent 1/3 in base 10, there's no elegant way to represent 1/10 in base 2.
- ilovepeppapig 7y agoThe worst way to explain something is to begin with "It's actually pretty simple."
- The_rationalist 7y agoNot always! E.g Let's say someone begin to explain me a topic and use e.g two words that I didn't knew before: e.g supervenience and congency. Humans generally are afraid of new words (especially weird sounding ones) and often will assume that the subject is complex and might intimidate them. But unknown words can have extremely simple meanings, or be synonyms of already known words. By asserting: "It's actually pretty simple" You give them confidence that there's not reason to be afraid of the topic or of the words.
- Zancarius 7y agoThere's much truth in this. Whenever I've helped older people with technology they've never used before (a new tablet or similar), if I started off with any suggestion that it's less than simple, they'll almost certainly frame the problem scope in their mind as difficult, and give up, because they're already exhibiting some animosity toward learning a new thing. If instead you phrase it as "this is really easy, let me show you how...", you short-circuit this process by framing their expectations differently, and that little bit of extra confidence ("this is easy") can help them through the learning process. I've found you can't simply show them, either. It's almost better to say "It's easy" and then go through the process, because it's absolutely necessary to establish expectations first. They're already afraid of it (it's new), so doing something to get their guard down can go a long way toward helping them explore on their own. I tried this experiment with my mother, and some weeks later she'd have a problem and discover the solution herself specifically because she was convinced it was easy to do. This can (and will) backfire if you're not careful about how you do it, but I've had far more success using this tool than other techniques individually (e.g. writing down instructions). This doesn't broadly apply to areas outside education and support (or even to all areas in education), but for simple things that people may express an irrational fear over, it works and it works well. A good teacher will use this technique successfully with their students, so if you're teaching someone, use it!
- aitchnyu 7y agoWhoa. In FF, I just see a screenfull of blank boxes. I scroll down and see content wrongly rendered. On Chrome its a dated design with an uncomfortable text size, and the narrow column creates boxes where I have to use horizontal scrollbars. The Motherfucking Website revolution cant come too soon enough!