I found that saving doubles to a SQLServer database via pymssql resulted in a loss of precision. Specifically, if i retrieve a double after saving it, it only matches up to around 8 digits (which is approximately what you can expect from single precision, instead of double precision).
I also found that doubles were translated to strings using str instead of repr. Python only guarantees that float(repr(x)) == x, not that float(str(x)) == x.
From dieterv77 on December 29, 2011 06:43:00
I found that saving doubles to a SQLServer database via pymssql resulted in a loss of precision. Specifically, if i retrieve a double after saving it, it only matches up to around 8 digits (which is approximately what you can expect from single precision, instead of double precision). I also found that doubles were translated to strings using str instead of repr. Python only guarantees that float(repr(x)) == x, not that float(str(x)) == x.
I created a fork of this project that includes two changes related to precision. The fork is http://code.google.com/r/dieterv77-pymssql/ and the commit is 4c3e2271dd7e.
There is also a unrelated, minor speed improvement in commit bd9a2213b632.
Thanks very much
Original issue: http://code.google.com/p/pymssql/issues/detail?id=79