Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#72 Too few decimals for floats

MySQLdb-0.9.2
closed
Andy Dustman
MySQLdb (285)
5
2012-09-19
2003-11-27
Joakim Sernbrant
No

The default Thing2Str converter outputs too few
decimals for floats:

Python 2.2.3 (#1, Jun 10 2003, 16:41:13)
[GCC 3.3 20030604 (Red Hat Linux 3.3-5)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import MySQLdb
>>> from math import pi
>>> db = MySQLdb.connect(...)
>>> print "%s" % db.literal(pi)
3.14159265359
>>> print "%.15g" % pi
3.14159265358979
>>>

Add a specialized converter that outputs at least 15
decimals which is what both Python and Mysql supports
for float/double precision (64 bit IEEE 754).

Discussion

  • Andy Dustman
    Andy Dustman
    2003-12-13

    Logged In: YES
    user_id=71372

    will be in 0.9.3b3

     
  • Andy Dustman
    Andy Dustman
    2003-12-13

    Logged In: YES
    user_id=71372

    This has been fixed in the current CVS tree.