double floating point precision and MySQL (Page 1) / Version 5 / Gmap3 - Forum:

There's still one problem, but I guess I can ignore it.
Setting precision explicitely means [MySQL] uses this precision always.
e.g. even for lower precision numbers.
So, 13.12847910000005 becomes 13.128479100000050 (15 precision) or even 13.1284791000000496 (16 precision).

If one needs to have accurate numbers you better store them as strings. And if you need to display accurate numbers but also calculate in MySQL with the floating point numbers you have to store two values, one float, one string.

Painfully, I'm starting to see the wisdom of storing decimal numbers as strings.  I mean, better yet is just to use 0-249 of each byte (more efficient and still mnemonic for traditionally ten-fingered cultures), but you get the point.

I'm trying to figure out what MySQL thinks a REAL is.  Well, it's a DOUBLE by default, but I'm having a hard time (> 5 min ;^D) Googling up what DOUBLE's precision is.

Labels: ,