Go to file
Simon Michael 8d75635505 print: limit display precision of generated prices (#262)
When a transaction posts to two commodities without specifying the
conversion price, we generate a price which makes it balance
(cf http://hledger.org/manual.html#prices).

Until now, these generated prices were always shown with full precision
(all available decimal digits) so that a manual calculation with the
displayed numbers would agree.

If there's just one posting in the commodity being priced, we can use an
exact total price and the precision is no problem.

But if there are multiple postings in the commodity being priced, we
must show the averaged unit price. This can be an irrational number,
which with our current Decimal-based implementation would display an
excessive 255 decimal digits. So in this case we now set the price's
display precision to the sum of the (max) display precisions of the
commodities involved. An example:

hledgerdev -f- print
<<<
1/1
    c    C 10.00
    c    C 11.00
    d  D -320.00
>>>
2015/01/01
    c  C 10.00 @ D 15.2381
    c  C 11.00 @ D 15.2381
    d     D -320.00

>>>=0

There might still be cases where this will show more price decimal
places than necessary. For now, YAGNI.
2015-05-27 14:21:19 -07:00
bin
checks update dev setup tests 2015-03-16 17:59:06 -07:00
data
doc doc: manual: change journal screenshot 2015-05-25 18:25:31 -07:00
extra extra: fix hledger-equity, hledger-rewrite compilation 2015-05-25 08:39:50 -07:00
hledger activity: don't exclude 0-amount postings by default 2015-05-21 16:38:17 -07:00
hledger-lib print: limit display precision of generated prices (#262) 2015-05-27 14:21:19 -07:00
hledger-web drop regexpr dependency 2015-05-17 08:32:45 -07:00
tests print: limit display precision of generated prices (#262) 2015-05-27 14:21:19 -07:00
tools
.gitignore git ignore profs, .hpc files 2014-10-31 16:33:55 -07:00
.version bump version to 0.26 alpha 2015-04-28 13:48:23 -07:00
buildSandbox.sh
help-system.mk tools: makefile updates, new sandbox rules 2015-04-07 17:18:18 -07:00
LICENSE
Makefile tools: fix make bin/hledger-webdev 2015-05-25 08:44:42 -07:00
README.md
sandbox.mk tools: makefile updates, new sandbox rules 2015-04-07 17:18:18 -07:00

hledger

lightweight, portable, dependable accounting tools

hledger is a computer program for easily tracking money, time, or other commodities, on unix, mac and windows (and web-capable mobile devices, to some extent).

It is first a command-line tool, but there is also a web interface and a Haskell library (http://hackage.haskell.org/package/hledger-lib) for building your own programs and scripts (hledger is written in Haskell). hledger was inspired by and is largely compatible with Ledger. hledger is free software available under the GNU General Public License v3+.

hledger aims to help both computer experts and regular folks to gain clarity and control in their finances and time management, but currently it is a bit more suited to techies. I use it every day to:

  • track spending and income
  • see time reports by day/week/month/project
  • get accurate numbers for client billing and tax filing
  • track invoices

Though limited in features, hledger is lightweight, usable and reliable. For some, it is a simpler, less distracting, more future-proof alternative to Quicken or GnuCash.

For more, see http://hledger.org.