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: Mon, 06 Jul 2015 09:55:54 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hello,

On 07/03/2015 12:02 AM, Timothy Rice wrote:
The thought crossed my mind that it would be good to have operations for
rounding and taking the floor or ceiling of numbers. Would there be
interest in this? Are there any gotchas that would need to be kept in mind
if it were implemented?

Interesting idea.

If I understand correctly, you intend this to be performed on every line 
(without grouping) ?
Such as:

    $ printf "1.4\n2.7\n" | datamash round 1 floor 1 ceil 1
    1    1    2
    3    2    3

I would intuitively think this is a job more suitable for awk,
however it seems that awk (at least gawk) requires a large helper function:
   https://www.gnu.org/software/gawk/manual/html_node/Round-Function.html

Would you think there's a need to round off to specific number of digits (e.g not 
always to integers, but round 2.459 => 2.46 ) ?

thanks,
 - assaf





reply via email to

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