[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-datamash] Rounding
From: |
Timothy Rice |
Subject: |
Re: [Bug-datamash] Rounding |
Date: |
Tue, 7 Jul 2015 15:50:40 +1000 |
Hey Assaf,
Wow, that's awesome! I just hammered it with a bunch of random numbers with
random decimals after them and it seems to be working perfectly. Just what
I was after :-)
Thanks a million!
Best regards,
Tim
On Tue, Jul 07, 2015 at 01:36:34AM -0400, Assaf Gordon wrote:
> Hello Tim,
>
> Here's an experimental version with rounding operations:
> http://files.housegordon.org/datamash/src/datamash-1.0.7.37-d303.tar.gz
>
> Works like this:
>
> $ ( echo X ; seq -1 0.25 1 ) \
> | datamash -H --full round 1 floor 1 ceil 1 trunc 1 frac 1
>
> X round(X) floor(X) ceil(X) trunc(X) frac(X)
> -1.00 -1 -1 -1 -1 0
> -0.75 -1 -1 0 0 -0.75
> -0.50 -1 -1 0 0 -0.5
> -0.25 0 -1 0 0 -0.25
> 0.00 0 0 0 0 0
> 0.25 0 0 1 0 0.25
> 0.50 1 0 1 0 0.5
> 0.75 1 0 1 0 0.75
> 1.00 1 1 1 1 0
>
>
>
> It's not final yet, but I hope these would make it into the next version.
>
> Feedback is very welcomed,
> - assaf