On 2016-07-05 3:02 PM, Ertan Küçükoğlu wrote:
I am using Delphi 10 for programming. Current variables are defined as Double (8 bytes 
real), saved in Database using something "DataSet.FieldByName('Amount').AsFloat := 
My_double_variable" However, I am now considering to convert all Double datatypes to 
Single (4 bytes real) for performance issues.

Do NOT change to using Single, always use Double, end to end.

First of all, Double is what SQLite uses internally for floats, per its documentation:

"The value is a floating point value, stored as an 8-byte IEEE floating point number."

So if you're already using Double in your app then staying that way should maintain accuracy, especially when you want accuracy for more than say 3-5 decimal digits in total.

Secondly, for financial applications, accuracy trumps performance. Converting to Single at any time is just going to cause you trouble.

And really, are you sure using Single would actually help performance? Have you measured it in a real workload? More likely on modern devices it won't be any faster and you will have lost your accuracy for nothing.

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to