django float round tripping
Robin Becker
robin at reportlab.com
Fri Apr 7 06:41:56 EDT 2017
I've been having problems with django FloatFields not round tripping properly; eg
field = 0.018903438896219302
gets saved and returns as
0.0189034388962193
It turns out that this is a property of the MySQLdb python interface where in
converter.py we have the definition
def Float2Str(o, d):
return '%.15g' % o
if I change this to
def Float2Str(o, d):
return repr(o)
I do seem able to get reproducibility.
Are there any downsides to making this change?
--
Robin Becker
More information about the Python-list
mailing list