| Reply | « Previous Thread | Next Thread » |
|
Dear All,
I hope you can help me to understand what is going on on my code. The problem I am facing is that I have an x,y value that are floats with many digits after the comma. I am storing these values into an e32db. When I am retrieving these values from the db, it seems many of the digits after the comma have been truncated. For example: A number like 9.15435791015625 becomes 9.154358. The problem is that I want to keep all the digits because, dropping them will reflect into a serious problem of precision for my application. Some other information on my implementation. 1) I am defining the values as 'DOUBLE PRECISION' on the db definition, sql CREATE; 2) I am using python floats into the sql insert: Code:
INSERT INTO Message (ID, uid, username, x, y, time, tipe, subject, content, parentID) VALUES (%d,%d,'%s',%f,%f,#%s#,'%s','%s','%s',%d)"%(
self.last_id,
uid,
self.username,
self.x,
self.y,
....
Code:
def select_all(self, query):
self.dbv.prepare(self.db, unicode(query))
self.dbv.first_line()
result = []
col_count = self.dbv.col_count()
for i in range(self.dbv.count_line()):
self.dbv.get_line()
row = [self.dbv.col(i+1) for i in range(col_count)]
result.append(row)
self.dbv.next_line()
return result
![]() Thanks a trillion Mauro http://www.i-cherubini.it/mauro/blog/ |
| madmartygan |
| View Public Profile |
| Find all posts by madmartygan |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Error: possible loss of precision... | aldrin002 | Mobile Java Media (Graphics & Sounds) | 1 | 2003-08-26 09:01 |