Hardware that the application will run is ~1Ghz Atom CPU, ~1GB RAM, regular 
Laptop HDD (no SSD). Time to time, there will be calculations, Network file 
transfer, and DLL function calls (all three) will be simultaneously running. 
Application has Timers and Socket listening components on it. My concern is to 
have a situation which "seems" like an application freeze.

On the other hand, will it be any help to increase accuracy to use Currency (8 
bytes fixed-point data type) in my application for Price and Total fields, 
leave Amount field as Double?

Thanks.

-----Original Message-----
From: sqlite-users-boun...@mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Darren Duncan
Sent: Wednesday, July 6, 2016 1:20 AM
To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] Currency & SQLite

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

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

Reply via email to