3 ms·
The problems with floats are independent of the basis. >1/10 just doesn't exist in that number system And 1/3 doesn't exist for b=10. I really have no idea w
by constantcrying 3y ago
The problems with floats are independent of the basis.
>1/10 just doesn't exist in that number system
And 1/3 doesn't exist for b=10.
I really have no idea what you are on about. The number system you want does not exist, it is a mathematical theorem, floats are the best approximation of real numbers and choosing b=10 is dumb outside of specific applications.
Decimal floating point fixes nothing it just moves around the issues where they less affect numbers in base 10. It is exactly as broken as base 2. You still violate basic identities in b=10, just different ones.
Again, the number system you want doesn't exist and it can't. You can never approximate the real numbers with constant bits, division and arithmetic consistency.
- erik_seaberg 3y agoFloats are probably the best approximation of irrational numbers near zero. Rational numbers don’t need to be approximated, unless you’re doing something like tight SIMD loops where the hardware itself limits precision, or letting an end user dictate how much precision he wants to see at the moment. There are corners we don’t need to cut anymore, because a half century of Moore’s Law has already paid for better tools if only we would claim them.
- constantcrying 3y ago>Floats are probably the best approximation of irrational numbers near zero. Floats are generally better near zero, but better (although less useful) approximations exist. >Rational numbers don’t need to be approximated Nonsense. "rational" datatypes are far less useful than floats. Approximating rationals by floats is usually better. FYI rational datatypes can not support operations which result in irrational numbers, such as exp, sqrt. >where the hardware itself limits precision Hardware does not limit precision. It implements IEEE 754. > letting an end user dictate how much precision he wants to see at the moment. Those are arbirtrary precision numbers. >There are corners we don’t need to cut anymore, because a half century of Moore’s Law has already paid for better tools if only we would claim them. Total nonsense. Fast floats have never been more important than they are now.
- PaulHoule 3y agoThe trouble is that we are using base 10 literals together with base 2 numbers. If you had base 35 literals and base 35 numbers or whatever it would be OK. All I'm asking for is literals that match the numbers I am using. If my float literals were like 431*2^-9 where 2^-9 is 1/512 there would be no semantic gap here. The fact that you find it so hard to get what I am talking about isn't reflective of your intelligence, it is that this is something that strikes people where they are absolutely weakest, where the gap between the map and the territory can leave you absolutely lost. That's what is so bad about it. Of course that is why computer professionals suffer with the "grind" and "nerd" slurs, because we tolerate things like the language that puts the C in Cthulhu. Personally I think Cantor's phony numbers suck and it is an insult that we call them "real" numbers. It's practically forgotten that Turing discovered the theory of computation not by investigating computation but by confronting the problem that there are two kinds of "real" numbers: the ones that are really real because they have names (e.g. 4, sqrt(2), π) and the vastly larger set of numbers that can never be picked out individually (e.g. any description of how to compute a number has to be finite in length but the phony numbers are uncountable.) I wish Steve Wolfram would grow some balls and reject the axiom of choice.
- FabHK 3y agoI am starting to come around to your argument. Having the internal representation in different base than the written representation does produce problems (for example, printing a base-2 float in its shortest base-10 representation is not a trivial problem, with solutions only appearing in the late 90's, see Dragon4 and Grisu3 [1]). Like with random number generators - computers are so powerful now that it makes sense to make the default PRNG cryptographically secure, to avoid misuse, and leave it up to the experts to swap in a fast (not cryptographically secure) PRNG in the rare cases where the performance is needed (and unpredictability isn't), for example Monte Carlo simulations. One could argue that for many use cases (most spreadsheets handling money amounts, for example) computers are powerful enough now that "non-integer numbers" should default to some base-10 floating point, so that internal and user representation coincide. Experts that handle applications with "real" numbers can then explicitly switch to "weird float". It is worth a thought. [1] https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.4049 https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.... https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/p... https://en.wikipedia.org/wiki/Floating-point_arithmetic#Binary-to-decimal_conversion_with_minimal_number_of_digits https://en.wikipedia.org/wiki/Floating-point_arithmetic#Bina...