4 ms·
I never said that they don't have applications. And you can do all those things with real numbers. What's your point?
by man-and-laptop 8y ago
I never said that they don't have applications. And you can do all those things with real numbers. What's your point?
- Const-me 8y ago> you can do all those things with real numbers. No you can't. > What's your point? Floats really have lots of advantages over exact real numbers. Being able to compute transcendental functions is one of them. There're others. They're freaking fast, my cheap laptop with integrated GPU can do almost 1 TFlops. They're fixed size i.e. you can handle them without dynamic memory allocations.
- deleted 8y ago[deleted]
- gjm11 8y agoI think you may be misunderstanding what the other guy means by exact real numbers: not rationals (for which indeed you can't do things like square roots) but real numbers expressed, say, as functions that deliver arbitrarily close rational approximations. With these you can compute e.g. square roots just fine. They have disadvantages of their own, though: for instance, y if two of these are equal then in general you can't determine that they are in finite time.
- man-and-laptop 8y ago> if two of these are equal then in general you can't determine that they are in finite time. This is arguably a problem with floating point as well. Two computations F and G which ought to produce the same result can end up differing because of rounding errors. So equality testing is not advisable to do over floating point. Also, inequality of real numbers is still semi-decidable, which is useful. People keep bringing up these problems around not being able to compute discontinuous functions, but those problems still manifest themselves over the floating point numbers, in the sense that a small rounding error in the input can drastically affect the output. This obviously isn't a problem over the rational numbers, but a lot of operations like square-root are not possible over the rational numbers.
- Const-me 8y agoSymbolic computations are even slower than rational numbers. If you only need a couple numbers, you’ll probably be OK, but if you need a billion of them, you’ll have problems. While both rationals and symbolics have their use, saying that floats don’t have any advantages over them is just wrong.
- man-and-laptop 8y agoYou're claiming I said things I didn't say. Two things: 1. I did acknowledge that floating point numbers are faster. I expressly stated that they do have some advantages over real numbers. 2. I'm not talking about symbolic computation.
- Const-me 8y ago> I did acknowledge that floating point numbers are faster Yes you did. And then you said it’s their only advantage. It’s not the only one. For example, in some environments, dynamic memory is undesirable. Especially since you mentioned physical sensors: many real-life sensors are not directly connected to PCs but instead are handled by MCU chips. > I'm not talking about symbolic computation. The numbers you’re talking about are pretty close to symbolics in many practical aspects. From Wikipedia article “Computable number”: equivalent definitions can be given using μ-recursive functions, Turing machines, or λ-calculus
- man-and-laptop 8y agoI didn't mention memory use and dynamic allocation because I thought it was obvious. I filed it under "faster".
- magduf 8y agoNo, it's not just "faster", it makes the difference between possible and impossible. With a physical sensor connected to a small MCU, either you do floats, or you do nothing at all. There's simply no way for a machine like that to do math the way you're thinking. I see this all the time with developers who have zero embedded experience like you: you don't seem to understand that in many embedded environments, dynamic memory allocation is simply not possible. You allocate all memory at the start of the program, and that's it. So doing math the way you suggest is completely impossible.