[Top][All Lists]

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

Why inf is not supported by gawk?

From: Peng Yu
Subject: Why inf is not supported by gawk?
Date: Fri, 25 Jun 2021 13:30:22 -0500

C can process "inf".

  Besides handling input, 'gawk' also needs to print "correct" values
on output when a value is either NaN or infinity.  Starting with version
4.2.2, for such values 'gawk' prints one of the four strings just
described: '+inf', '-inf', '+nan', or '-nan'.  Similarly, in POSIX mode,
'gawk' prints the result of the system's C 'printf()' function using the
'%g' format string for the value, whatever that may be.

Why awk does not understand "inf" as infinity? Is it better to support
it? (I only care about the normal mode, I don't care about any other
non-default modes.)

$ gawk -e '{ print $1 + 1 }' <<< "inf"
$ gawk -e '{ print $1 + 1 }' <<< "+inf"


reply via email to

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