|
From: Richard F. <fa...@be...> - 2016-01-27 23:51:07
|
On 1/27/2016 12:33 PM, Stavros Macrakis (Σταῦρος Μακράκης) wrote: > Is auto-promotion of floats to bfloats a good idea? There is an argument to be made that machine floats are just too confusing to use. We probably all recall newbie questions about why Maxima floats come up as x.999999999 . The answer being "That's the way binary floats work" in every language. Here's one alternative. (Parts were/are? used in Maple). 1. All numeric input is treated as exact decimal and stored as decimal. 2. All internal numbers are, in effect, decimal bigfloats. 3. bigfloat precision is a simple decimal number of digits. 4. underlying representation can be the existing decimal bigfloats already in Maxima. (Maxima has both decimal and binary. The decimal bigfloats are used for computing output forms. Multiplying/dividing by 10 is presumably slower than shifting, but what's the hurry?) Consequences: 1. no newbie questions. 2. no overflow. The exponent is an arbitrary integer. At least the bound is what comes with your lisp/hardware. 3. no underflow. The exponent is an arbitrary negative integer. 4. There is a clear separation between very large numbers and "Infinity" symbol(s). 5. The discrepancy between lisp implementations will disappear -- we will not see the handling of overflows as exceptions in system 1 and the production of In.fty in system 2. 6. We could have a set of routines that "converts to machine float and calls numeric libraries" for quadrature, numeric float linear algebra subroutines, etc. Negative consequences 1. Eh, not so fast? Would anyone notice the machine float speed in the blizzard of other operations surrounding each operation? 2. The reverse newbie questions, which is to say, someone says How is it that 0.1 is exactly the same as 1/10 on Maxima, when I know they differ by 5.2e-18 in binary. 3. There is still rounding error, setting precision appropriately matters. 4. Reprogramming, redocumentation,. Please feel free to comment/ elaborate/implement? RJF > > Are there practical applications, where a user will get a useful > answer rather than an error to a substantive problem > ? I doubt it; I suspect this only happens with > > artificial problem > s > designed to test Maxima's limit > s.) No, I think people fall into underflow/overflow traps unintentionally. Not deliberately testing Maxima, but at the border of their smarts. So the purpose would be to give an answer that deserves further thought instead of "darn, it bombed out". |