bug-datamash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-datamash] Decimal separator


From: Assaf Gordon
Subject: Re: [Bug-datamash] Decimal separator
Date: Sat, 11 Jun 2016 18:45:03 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

Hello Marin,

On 06/10/2016 05:44 AM, Martin Heller wrote:
From: Assaf Gordon [mailto:address@hidden

[...]

'datamash' uses a function called 'strtold' to convert numbers [1], and this
function respects the correct locale.
This is likely the reason for this unexpected behavior.

Yes, I realize this now. However, it was unexpected for me. E.g. calculating
the mean other tools using the same data.txt file works as expected:

awk:

t:\>awk "{ total += $1; count++ } END { print total/count }" data.txt
4.5

Octave:

T:\>octave-cli.exe -qf --eval "d=load('data.txt');mean(d)"
ans =  4.5000

I even don't know if it is possible to get awk/Octave to expect anything
else than dot as the decimal mark.

[...]

Unfortunately, it does not work. Here is the output:

T:\>set LC_NUMERIC=C & set LC_LANG=C & set LC_ALL=C

T:\>set LC
LC_ALL=C
LC_LANG=C
LC_NUMERIC=C

T:\>cat data.txt | datamash-win32 mean 1
datamash-win32: invalid numeric value in line 1 field 1: '0.1'

Thanks for pointing this. I'll check with other programs how they handle this 
situation on Windows,
and if need be, adapt datamash accordingly.
I am not a programmer, so for me downloading the executable is
the preferred option.

I've built two new Windows executables (32bit and 64bit) using the latest 
version,
with disabled locale setting (always using default "C" locale):

   http://download-mirror.savannah.gnu.org/releases/datamash/windows-binaries/

If you can, please test these and let me know if they work better.

regards,
 - assaf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]