On Dienstag, 15. November 2022 01:01:03 CET Chris via KMyMoney-devel wrote:
> I was going through the database tables when a file was stored as sqlcipher. > > I came across something I haven't seen before and I was wondering why it was > that way > > Transaction values are stored as text strings but with unusual divisors. > > For example the value 18.95 may be stored as "1895/100" which is 1895 > divided by 100 = 18.95. All and good > > but there are other ones which confuse me as to why its done this way. > > Examples are ... > > unformatted => formatted > 258/25 => 10.32 > 124/25 => 4.96 > -273/50 => -5.46 > 1/2 => 0.5 > > Can some one explain why it is done that way? See https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency for the details of why we use the "numerator/denominator" representation. The ones that confuse you are simply canceled to the smallest denominator. That's a feature/requirement of the underlying library. > 124/25 => 4.96 124/25 * 4/4 => 496/100 -- Regards Thomas Baumgart ------------------------------------------------------------- My software never has bugs. It just develops random features ... -- anonymous -------------------------------------------------------------
signature.asc
Description: This is a digitally signed message part.