If yours is a financial application then you should be using exact numeric types
only, such as integers that represent multiples of whatever quantum you are
using, such as cents; fractional numbers are a display or user input format
only, and in those cases they are character strings. -- Darren Duncan
On 2018-12-14 10:49 PM, Frank Millman wrote:
Hi all
I know that floating point is not precise and not suitable for financial uses.
Even so, I am curious about the following -
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open /sqlite_db/ccc
sqlite> select sum(amount_cust) from ar_trans where cust_row_id = 4 and
tran_date between '2015-05-01' and '2015-05-31';
211496.26
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import sqlite3
sqlite3.sqlite_version
'3.26.0'
conn = sqlite3.connect('/sqlite_db/ccc')
cur = conn.cursor()
cur.execute("select sum(amount_cust) from ar_trans where cust_row_id = 4 and
tran_date between '2015-05-01' and '2015-05-31'")
<sqlite3.Cursor object at 0x000002C1D6BBCF80>
cur.fetchone()
(211496.25999999992,)
With the same version of sqlite3 and the same select statement, why does python
return a different result from sqlite3.exe?
Thanks
Frank Millman
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users