bug-datamash
[Top][All Lists]
Advanced

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

Re: [Bug-datamash] Rounding


From: Assaf Gordon
Subject: Re: [Bug-datamash] Rounding
Date: Tue, 7 Jul 2015 01:36:34 -0400

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



reply via email to

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