Hi,
Does anyone knows why floating point numbers are truncated when they are
written or read from the database?!
The following code truncates the number so that precision is lost!
rc = sqlite3_exec(db, "create table test_tab (num_row real)", callback, 0,
&zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}
rc = sqlite3_exec(db, "insert into test_tab (num_row)
values(1.12345678901234567890)", callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}
rc = sqlite3_exec(db, "select num_row from test_tab", callback, 0,
&zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}
The result ist "1.12345678901235"!? Is there any fixed size for the
printf's??? Can I change it without changing the sourcecode?!
Best regards, Andreas Terganov
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users