Re: Decimal Precision

2023-03-03 Thread Daniele Nicolodi
On 02/03/23 19:28, fin wrote: i'll figure it out eventually now that i know the error is indeed something i did wrong and not the error/rounding issue. AFAIK there are never been bugs reported on Beancount regarding inaccuracies due to rounding or other computing errors. The only issues someh

Re: Decimal Precision

2023-03-02 Thread fin
Daniele Nicolodi wrote: > On 02/03/23 15:53, fin wrote: >>i'm trying to wade through all these various docs and >> mentions about precision because i'm trying to figure out >> why certain transactions do not balance (and fava complains). > > Your example below does not balance for 1087.5 USD. W

Re: Decimal Precision

2023-03-02 Thread Daniele Nicolodi
On 02/03/23 15:53, fin wrote: i'm trying to wade through all these various docs and mentions about precision because i'm trying to figure out why certain transactions do not balance (and fava complains). Your example below does not balance for 1087.5 USD. Why do you think it due to precisio

Re: Decimal Precision

2023-03-02 Thread fin
Martin Blais wrote: ... > Search the list for various discussion of the current limitations of the > stable branch. > See also the discussion here (v3 doc): > https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/edit#heading=h.vy9jgsdfwj8e i'm trying to wade through al

Re: Decimal Precision

2022-07-26 Thread William Bean
Just closing the loop on this. I combed through all the information you posted links to, which was extremely helpful and thorough. Thank you. Turns out my use cases were pretty explicitly discussed in the historical notes portion of your precision documentation. In case others find it helpful here

Re: Decimal Precision

2022-07-26 Thread William Bean
Thanks Martin. That's very helpful. I'm going to digest it a little bit and gather my thoughts. I have 2 use cases which have come up, one for reporting and the other for mathematically calculated posting amounts. I'll put together some examples of the use cases when I get a little more time. Side

Re: Decimal Precision

2022-07-25 Thread Martin Blais
Search the list for various discussion of the current limitations of the stable branch. See also the discussion here (v3 doc): https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/edit#heading=h.vy9jgsdfwj8e By "producing" it would be useful to know what you mean; what t

Re: decimal

2021-04-06 Thread Martin Blais
Try setting the tolerance for the instruments option "inferred_tolerance_default" "SMG-ASIE:0.05" The rendering code is buried in here somewhere: https://github.com/beancount/beancount/blob/master/beancount/query/query_render.py All that code will be thrown away and get rewritten eventuall

Re: decimal

2021-04-06 Thread francois PEGORY
unfortunatly it don't work. because if do this. some operations does not balance. example with option "inferred_tolerance_default" "EUR:0.01", it balance well. with option "inferred_tolerance_default" "EUR:0.0005" , it does not balance anymore ... 2019-09-30 * "Achat" "" Assets:Titre:PEE

Re: decimal

2021-04-05 Thread Martin Blais
Precision selected for BQL is a bit of a mess. Just another reason why it needs a rewrite. This is really gnawing at me, but I just don't have the cycles to rewrite it Try this in the meantime: option "inferred_tolerance_default" "EUR:0.0005" On Mon, Apr 5, 2021 at 4:08 PM francois PEGORY wrot

Re: Decimal(): understanding, syntax

2020-08-10 Thread Daniele Nicolodi
On 10/08/2020 03:52, nugget wrote: > As a summary, what i think I leared: > > * The design of Beancounts D() technically allows allows higher > precision (float) numbers as input. Floating points numbers have finite precision. Decimal numbers (as in Python Decimal objects) have arbitrary pr

Re: Decimal(): understanding, syntax

2020-08-10 Thread Martin Michlmayr
* nugget [2020-08-10 02:52]: >- The design of Beancounts D() technically allows allows higher >precision (float) numbers as input. Not float as in the data type float. You pass a string to Decimal() because floats already have rounding that you can avoid with Decimal() >- But the de

Re: Decimal(): understanding, syntax

2020-08-10 Thread Martin Michlmayr
* nugget [2020-08-10 02:52]: >- The design of Beancounts D() technically allows allows higher >precision (float) numbers as input. >- But the design philosophy does not. It requires string typed numbers >with maximum precision to the second digit. Higher precision is not >su

Re: Decimal(): understanding, syntax

2020-08-10 Thread nugget
As a summary, what i think I leared: - The design of Beancounts D() technically allows allows higher precision (float) numbers as input. - But the design philosophy does not. It requires string typed numbers with maximum precision to the second digit. Higher precision is not supp

Re: Decimal(): understanding, syntax

2020-08-09 Thread Daniele Nicolodi
On 08/08/2020 10:41, Daniele Nicolodi wrote: > Another thing to potentially consider is to reduce the number of decimal > digits used when serializing Decimal numbers. Maybe 12 (or so) digits > are enough instead that the current 28. I am sure someone has a model for when 1e-12 BTC will be worth t

Re: Decimal(): understanding, syntax

2020-08-08 Thread Daniele Nicolodi
On 07/08/2020 23:48, Martin Blais wrote: > On Sat, Aug 8, 2020 at 12:31 AM Daniele Nicolodi > wrote: > > On 07/08/2020 15:49, nugget wrote: > > Hi all, > > i get these very long decimal numbers when using the Decimal() method. > > See my minimal example.

Re: Decimal(): understanding, syntax

2020-08-08 Thread Daniele Nicolodi
On 08/08/2020 01:11, nugget wrote: > thanks for your replies.  > I actually thought Decimal() is meant to turn a float into something > nice for bookkeeping (that was my interpretation of the docs) > My underlying question is what is the intended way to handle rounding > errors? I.e. when splitting

Re: Decimal(): understanding, syntax

2020-08-08 Thread Martin Michlmayr
* nugget [2020-08-08 00:11]: > I.e. when splitting up a transaction into multiple transactions. > say distribute a yearly transaction over 12 months or a weekly one > over 7 days. > > Naively, I would take 1 CHF and divide it by 12, and make 12 > transactions. I dislike having my posting look

Re: Decimal(): understanding, syntax

2020-08-08 Thread nugget
thanks for your replies. I actually thought Decimal() is meant to turn a float into something nice for bookkeeping (that was my interpretation of the docs) My underlying question is what is the intended way to handle rounding errors? I.e. when splitting up a transaction into multiple transaction

Re: Decimal(): understanding, syntax

2020-08-07 Thread Martin Blais
On Sat, Aug 8, 2020 at 12:31 AM Daniele Nicolodi wrote: > On 07/08/2020 15:49, nugget wrote: > > Hi all, > > i get these very long decimal numbers when using the Decimal() method. > > See my minimal example. How can I fix this? > > What is exactly the problem you want to "fix"? > > 1/9 is a perio

Re: Decimal(): understanding, syntax

2020-08-07 Thread Daniele Nicolodi
On 07/08/2020 15:49, nugget wrote: > Hi all, > i get these very long decimal numbers when using the Decimal() method. > See my minimal example. How can I fix this? What is exactly the problem you want to "fix"? 1/9 is a periodic number that cannot be represented with a finite number of decimal di

Re: Decimal(): understanding, syntax

2020-08-07 Thread Martin Michlmayr
* nugget [2020-08-07 14:49]: > i get these very long decimal numbers when using the Decimal() > method. See my minimal example. How can I fix this? rounding to two > digits seems not to be the solution. Thanks! This is what I use to round decimal numbers: def d_round(d): return d.quantize(D(