[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get Inf in awk?
From: |
Andrew J. Schorr |
Subject: |
Re: How to get Inf in awk? |
Date: |
Mon, 4 May 2020 20:54:53 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, May 04, 2020 at 06:02:38PM -0500, Peng Yu wrote:
> I am trying to use Inf in awk. But the follow code does not work. Does
> anybody know what is the correct way to use Inf in awk?
>
> $ awk -e 'BEGIN { print +inf-1 }'
> -1
Here are a couple of approaches:
bash-4.2$ gawk 'BEGIN {print "+inf"-1}'
+inf
bash-4.2$ gawk --posix 'BEGIN {print "inf"-1}'
+inf
Regards,
Andy