Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Setting precision on the command line
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Martin Michlmayr  
View profile  
 More options Jul 1 2012, 4:59 pm
From: Martin Michlmayr <t...@cyrius.com>
Date: Sun, 1 Jul 2012 21:59:26 +0100
Local: Sun, Jul 1 2012 4:59 pm
Subject: Setting precision on the command line
Let's say I have 2 funds in an account.  Fund AAA is 10.123 EUR at
current market value and BBB is worth 20.123 EUR.

When my broker shows the market value of my whole account, they round
each account and add everything up, i.e. 10.12 + 20.12 = 30.24.

However, ledger keeps all the precision, calculates 10.123 + 20.123 =
30.246 and shows 30.25.

Is there a way so I can tell ledger - ideally on the command line - to
limit precision to 2 digits, so I'll get the same result as what my
broker shows?

Test case:

D 1000.00 EUR

2012-01-01 *
   A                        1 AAA @@ 10.00 EUR
   A                        1 BBB @@ 20.00 EUR
   C

P 2012-07-01 AAA 10.123 EUR
P 2012-07-01 BBB 20.123 EUR

$ ledger -f a bal -V A
           30.25 EUR  A

--
Martin Michlmayr
http://www.cyrius.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Wiegley  
View profile  
 More options Jul 2 2012, 8:17 pm
From: "John Wiegley" <jo...@newartisans.com>
Date: Mon, 02 Jul 2012 19:17:33 -0500
Local: Mon, Jul 2 2012 8:17 pm
Subject: Re: Setting precision on the command line

>>>>> Martin Michlmayr <t...@cyrius.com> writes:
> Is there a way so I can tell ledger - ideally on the command line - to limit
> precision to 2 digits, so I'll get the same result as what my broker shows?

At present there is no "trap" for this.  I'll have to think about it.  It may
be really easy, or it might require some significant changes.

The problem is that you can rewrite the individual posting amounts (too fine),
and you can rewrite the final account totals (too coarse), but you can't
rewrite the individual account totals in between.

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Michlmayr  
View profile  
 More options Jul 12 2012, 12:12 pm
From: Martin Michlmayr <t...@cyrius.com>
Date: Thu, 12 Jul 2012 10:12:07 -0600
Local: Thurs, Jul 12 2012 12:12 pm
Subject: Re: Setting precision on the command line
* John Wiegley <jo...@newartisans.com> [2012-07-02 19:17]:

> > Is there a way so I can tell ledger - ideally on the command line - to limit
> > precision to 2 digits, so I'll get the same result as what my broker shows?

> At present there is no "trap" for this.  I'll have to think about it.  It may
> be really easy, or it might require some significant changes.

Thanks, John.  I've filed a bug so this is tracked.

--
Martin Michlmayr
http://www.cyrius.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »