On Dienstag, 15. November 2022 09:08:44 CET Chris via KMyMoney-devel wrote:

> Thanks
> 
> I have always used integer's, never floats or doubles, I realised back in 
> the 90's that was a mistake when implementing credit card transactions. 
> Rounding errors bite hard.
> 
> I have always decided at the start of a project what was the maximum 
> precision needed, usually 2 decimal places but occasionally more. I can see 
> with kmymoney 4 digits is the best because I believe that is normal for 
> shares. however I don't do shares so I could be wrong.
> 
> Just looked it up, shares below $1.00 is to 4 decimal places, 2 places 
> otherwise.
> 
> I can see storing it using numerator denominator is more flexible.

4 digits is not enough if it comes to currency exchange. We do have a user
that converts between (I believe) Indonesian Rupia and Euros a lot and
needs at least 10 digits of precision for the price to get correct results.

-- 

Regards

Thomas Baumgart

-------------------------------------------------------------
Testing can only prove the presence of bugs, not their absence.
 -- Edsger W. Dijkstra, 1969
-------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to