[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".
https://stackoverflow.com/questions/1923837/how-to-use-nan-and-inf-in-c
"""
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"
1
$ gawk -e '{ print $1 + 1 }' <<< "+inf"
+inf
--
Regards,
Peng
- Why inf is not supported by gawk?,
Peng Yu <=