From 571ea1540b8581e399c2e8d30e8c26e492eec233 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 31 Mar 2018 02:41:31 +0100 Subject: [PATCH] document scientific notation (#704, #706) --- hledger-lib/hledger_journal.5 | 13 ++++ hledger-lib/hledger_journal.info | 123 +++++++++++++++--------------- hledger-lib/hledger_journal.m4.md | 5 +- hledger-lib/hledger_journal.txt | 4 + 4 files changed, 84 insertions(+), 61 deletions(-) diff --git a/hledger-lib/hledger_journal.5 b/hledger-lib/hledger_journal.5 index 7d81bbb43..0d8680733 100644 --- a/hledger-lib/hledger_journal.5 +++ b/hledger-lib/hledger_journal.5 @@ -369,6 +369,17 @@ Some examples: .P .PD \f[C]1\ 999\ 999.9455\f[] +.PD 0 +.P +.PD +\f[C]EUR\ 1E3\ \ \ #\ 1000\ euros\f[] +.PD 0 +.P +.PD +\f[C]1000E\-6s\ \ #\ 1000\ microseconds\f[] +.PD 0 +.P +.PD .PP As you can see, the amount format is somewhat flexible: .IP \[bu] 2 @@ -389,6 +400,8 @@ groups .IP \[bu] 2 decimal part can be separated by comma or period and should be different from digit groups separator +.IP \[bu] 2 +scientific E\-notation (without digit groups) is allowed .PP You can use any of these variations when recording data. However, there is some ambiguous way of representing numbers like diff --git a/hledger-lib/hledger_journal.info b/hledger-lib/hledger_journal.info index 89b00dee9..5de9d0f11 100644 --- a/hledger-lib/hledger_journal.info +++ b/hledger-lib/hledger_journal.info @@ -349,6 +349,8 @@ commodity name. Some examples: 'INR 9,99,99,999.00' 'EUR -2.000.000,00' '1 999 999.9455' +'EUR 1E3 # 1000 euros' +'1000E-6s # 1000 microseconds' As you can see, the amount format is somewhat flexible: @@ -365,6 +367,7 @@ commodity name. Some examples: all groups * decimal part can be separated by comma or period and should be different from digit groups separator + * scientific E-notation (without digit groups) is allowed You can use any of these variations when recording data. However, there is some ambiguous way of representing numbers like '$1.000' and @@ -1199,65 +1202,65 @@ Node: Account names11239 Ref: #account-names11382 Node: Amounts11869 Ref: #amounts12005 -Node: Virtual Postings14685 -Ref: #virtual-postings14844 -Node: Balance Assertions16064 -Ref: #balance-assertions16239 -Node: Assertions and ordering17135 -Ref: #assertions-and-ordering17321 -Node: Assertions and included files18021 -Ref: #assertions-and-included-files18262 -Node: Assertions and multiple -f options18595 -Ref: #assertions-and-multiple--f-options18849 -Node: Assertions and commodities18981 -Ref: #assertions-and-commodities19216 -Node: Assertions and subaccounts19912 -Ref: #assertions-and-subaccounts20144 -Node: Assertions and virtual postings20665 -Ref: #assertions-and-virtual-postings20872 -Node: Balance Assignments21014 -Ref: #balance-assignments21183 -Node: Prices22303 -Ref: #prices22436 -Node: Transaction prices22487 -Ref: #transaction-prices22632 -Node: Market prices24788 -Ref: #market-prices24923 -Node: Comments25883 -Ref: #comments26005 -Node: Tags27247 -Ref: #tags27365 -Node: Directives28767 -Ref: #directives28880 -Node: Account aliases29073 -Ref: #account-aliases29217 -Node: Basic aliases29821 -Ref: #basic-aliases29964 -Node: Regex aliases30654 -Ref: #regex-aliases30822 -Node: Multiple aliases31540 -Ref: #multiple-aliases31712 -Node: end aliases32210 -Ref: #end-aliases32350 -Node: account directive32451 -Ref: #account-directive32631 -Node: apply account directive33978 -Ref: #apply-account-directive34174 -Node: Multi-line comments34833 -Ref: #multi-line-comments35023 -Node: commodity directive35151 -Ref: #commodity-directive35335 -Node: Default commodity36207 -Ref: #default-commodity36380 -Node: Default year36917 -Ref: #default-year37082 -Node: Including other files37505 -Ref: #including-other-files37662 -Node: Periodic transactions38059 -Ref: #periodic-transactions38225 -Node: Automated postings39214 -Ref: #automated-postings39377 -Node: EDITOR SUPPORT40279 -Ref: #editor-support40404 +Node: Virtual Postings14800 +Ref: #virtual-postings14959 +Node: Balance Assertions16179 +Ref: #balance-assertions16354 +Node: Assertions and ordering17250 +Ref: #assertions-and-ordering17436 +Node: Assertions and included files18136 +Ref: #assertions-and-included-files18377 +Node: Assertions and multiple -f options18710 +Ref: #assertions-and-multiple--f-options18964 +Node: Assertions and commodities19096 +Ref: #assertions-and-commodities19331 +Node: Assertions and subaccounts20027 +Ref: #assertions-and-subaccounts20259 +Node: Assertions and virtual postings20780 +Ref: #assertions-and-virtual-postings20987 +Node: Balance Assignments21129 +Ref: #balance-assignments21298 +Node: Prices22418 +Ref: #prices22551 +Node: Transaction prices22602 +Ref: #transaction-prices22747 +Node: Market prices24903 +Ref: #market-prices25038 +Node: Comments25998 +Ref: #comments26120 +Node: Tags27362 +Ref: #tags27480 +Node: Directives28882 +Ref: #directives28995 +Node: Account aliases29188 +Ref: #account-aliases29332 +Node: Basic aliases29936 +Ref: #basic-aliases30079 +Node: Regex aliases30769 +Ref: #regex-aliases30937 +Node: Multiple aliases31655 +Ref: #multiple-aliases31827 +Node: end aliases32325 +Ref: #end-aliases32465 +Node: account directive32566 +Ref: #account-directive32746 +Node: apply account directive34093 +Ref: #apply-account-directive34289 +Node: Multi-line comments34948 +Ref: #multi-line-comments35138 +Node: commodity directive35266 +Ref: #commodity-directive35450 +Node: Default commodity36322 +Ref: #default-commodity36495 +Node: Default year37032 +Ref: #default-year37197 +Node: Including other files37620 +Ref: #including-other-files37777 +Node: Periodic transactions38174 +Ref: #periodic-transactions38340 +Node: Automated postings39329 +Ref: #automated-postings39492 +Node: EDITOR SUPPORT40394 +Ref: #editor-support40519  End Tag Table diff --git a/hledger-lib/hledger_journal.m4.md b/hledger-lib/hledger_journal.m4.md index f0c25eab3..b9df10f5e 100644 --- a/hledger-lib/hledger_journal.m4.md +++ b/hledger-lib/hledger_journal.m4.md @@ -268,7 +268,9 @@ Amounts consist of a number and (usually) a currency symbol or commodity name. S `-$1,000,000.00`\ `INR 9,99,99,999.00`\ `EUR -2.000.000,00`\ - `1 999 999.9455` + `1 999 999.9455`\ + `EUR 1E3 # 1000 euros`\ + `1000E-6s # 1000 microseconds`\ As you can see, the amount format is somewhat flexible: @@ -278,6 +280,7 @@ As you can see, the amount format is somewhat flexible: - negative amounts with a commodity on the left can have the minus sign before or after it - digit groups (thousands, or any other grouping) can be separated by space or comma or period and should be used as separator between all groups - decimal part can be separated by comma or period and should be different from digit groups separator +- scientific E-notation (without digit groups) is allowed You can use any of these variations when recording data. However, there is some ambiguous way of representing numbers like `$1.000` and `$1,000` both may mean either one thousand or one dollar. By default hledger will assume that this is sole delimiter is used only for decimals. On the other hand commodity format declared prior to that line will help to resolve that ambiguity differently: diff --git a/hledger-lib/hledger_journal.txt b/hledger-lib/hledger_journal.txt index dfa6b72ba..91d4b6c02 100644 --- a/hledger-lib/hledger_journal.txt +++ b/hledger-lib/hledger_journal.txt @@ -261,6 +261,8 @@ FILE FORMAT INR 9,99,99,999.00 EUR -2.000.000,00 1 999 999.9455 + EUR 1E3 # 1000 euros + 1000E-6s # 1000 microseconds As you can see, the amount format is somewhat flexible: @@ -282,6 +284,8 @@ FILE FORMAT o decimal part can be separated by comma or period and should be dif- ferent from digit groups separator + o scientific E-notation (without digit groups) is allowed + You can use any of these variations when recording data. However, there is some ambiguous way of representing numbers like $1.000 and $1,000 both may mean either one thousand or one dollar. By default