Re: Bug: Decimal point parsing fails with many points after decimal

2013-11-27 Thread Craig Earls
Ledger's default is period decimal.  Failure to parse comma decimal without
--decimal-comma is not a bug.  Although I believe it should fail better.
 You can define decimal comma in your initialization file so that you don;t
have to type it from the command line.


On Tue, Nov 26, 2013 at 5:51 PM, mor...@tarn-vedra.de wrote:

 It seems like ledger (latest HEAD and before) makes the wrong judgements
 about decimal comma or decimal point when parsing values like
 '0,098BTC' (it's parsed as '98,0082BTC' unless --decimal-comma is
 active). A small test case is available under
 http://p.tarn-vedra.de/ledger-decimal-bug.html

 egh in the IRC channel pointed me to this line, which is responsible for
 parsing:
 https://github.com/ledger/ledger/blob/bba851b8304ef1bb432bb0dc41b1e5c57bc9cc61/src/amount.cc#L1118

 Please note that I'm posting via the Google Groups interface - please
 excude broken formatting or similar.

 Cheers,
 Moritz Ulrich

 --

 ---
 You received this message because you are subscribed to the Google Groups
 Ledger group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to ledger-cli+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Bug: Decimal point parsing fails with many points after decimal

2013-11-27 Thread Erik Hetzner
At Wed, 27 Nov 2013 06:44:02 -0700,
Craig Earls wrote:
 
 Ledger's default is period decimal.  Failure to parse comma decimal without
 --decimal-comma is not a bug.  Although I believe it should fail better.
  You can define decimal comma in your initialization file so that you don;t
 have to type it from the command line.

Hi Craig,

ledger does do detection to try to figure out what format the amount
is in. It is this detection that seems to be failing when the number
of digits following the comma is evenly divisible by 3. You can see
this by comparing how

  Assets:Bitcoin:Local  0,98BTC

and:

  Assets:Bitcoin:Local  0,980BTC
^ extra 0

are parsed.

(Personally, I find code like this fragile and tend to just prefer the
user tell me, via LC_NUMERIC or some such how numerals are formatted.
After all, how are we to distinguish `1,012BTC`?) But the code to try
to figure this out is there.

-Erik
-- 
Sent from my free software system http://fsf.org/.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Bug: Decimal point parsing fails with many points after decimal

2013-11-27 Thread Craig Earls
Maybe we should take it out to match my documentation!

--
Craig

On Wed, Nov 27, 2013 at 10:00 AM, Erik Hetzner ehetz...@gmail.com wrote:

 At Wed, 27 Nov 2013 06:44:02 -0700,
 Craig Earls wrote:
 
 Ledger's default is period decimal.  Failure to parse comma decimal without
 --decimal-comma is not a bug.  Although I believe it should fail better.
  You can define decimal comma in your initialization file so that you don;t
 have to type it from the command line.
 Hi Craig,
 ledger does do detection to try to figure out what format the amount
 is in. It is this detection that seems to be failing when the number
 of digits following the comma is evenly divisible by 3. You can see
 this by comparing how
   Assets:Bitcoin:Local  0,98BTC
 and:
   Assets:Bitcoin:Local  0,980BTC
 ^ extra 0
 are parsed.
 (Personally, I find code like this fragile and tend to just prefer the
 user tell me, via LC_NUMERIC or some such how numerals are formatted.
 After all, how are we to distinguish `1,012BTC`?) But the code to try
 to figure this out is there.
 -Erik
 -- 
 Sent from my free software system http://fsf.org/.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Bug: Decimal point parsing fails with many points after decimal

2013-11-26 Thread moritz
It seems like ledger (latest HEAD and before) makes the wrong judgements 
about decimal comma or decimal point when parsing values like 
'0,098BTC' (it's parsed as '98,0082BTC' unless --decimal-comma is 
active). A small test case is available under 
http://p.tarn-vedra.de/ledger-decimal-bug.html

egh in the IRC channel pointed me to this line, which is responsible for 
parsing: 
https://github.com/ledger/ledger/blob/bba851b8304ef1bb432bb0dc41b1e5c57bc9cc61/src/amount.cc#L1118

Please note that I'm posting via the Google Groups interface - please 
excude broken formatting or similar.

Cheers,
Moritz Ulrich

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.