On 2018/12/18 1:21 AM, James K. Lowden wrote:

First, the problem is not storage it's calculation.

Second, the thread was started because a floating point calculation
in SQLite, exactly as it is run today, led to the following value:

211496.25999999992

which is typical of such problems.
What problem?  Rounded to the number of significant digits -- 2 decimal
places in the input -- the number is correct.


Exactly, and I would go further to suggest that the problem is much more to do with the human brain and visual concepts than the numbers.

Sure enough, as a mathematician the numbers
211496.25999999992 and
211496.26

look exactly the same to me (when I consider scales in the sub 15 digit range), as it does to an IEEE float, but you can see how, to the average onlooker's brain, those look vastly different - see them as pictures rather than numbers, which obviously look completely different - and this is what scares people and why this keeps being a problem.

I'm not even going to touch on silly/stupid programming and calculations that round along the intermediate steps, those have been mentioned already, they are evil and it isn't the fault of the storage medium.

The fact that the SQLite programmers and the Python programmers (or perhaps Python-SQLite-wrapper programmers) did not choose the same presentation is just one more case of "not the storage method's fault but indeed the interpretation's fault".


PS, a good video to cure you of "visual number deficit" sickness would be one of those explaining why 0.999... (recurring) is exactly equal to 1. (And that's not even touching IEEE....)
This be as good as any: https://www.youtube.com/watch?v=G_gUE74YVos


Cheers!
Ryan


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to