[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bugs in printf/sprintf formatted output
From: |
Maciej W. Rozycki |
Subject: |
Re: Bugs in printf/sprintf formatted output |
Date: |
Mon, 8 Jul 2024 16:04:18 +0100 (BST) |
Hi Arnold,
> Thanks for the patches. I will review and apply and credit appropriately.
Thank you.
> With respect to "nan" as input, the gawk manual is clear that "nan" and
> "inf" must be written as "+nan", "-nan", "+inf" or "-inf" to be
> recognized. Otherwise something like
>
> echo nancy | awk '{ print $1 + 1 }'
>
> prints "nan" instead of 1.
I have been aware of this peculiarity, as noted in my original report.
My suggestion would be making a separate test case (unless GAWK has one
already, but your inclusion of the two inputs in `printf-corners.awk'
suggests that it doesn't) that covers various inputs of "inf" and "nan"
with and without a sign prepended, with and without the `+' and `space'
flags, run both in the conventional (or GNU) and in the POSIX mode of
GAWK, so that expectations for both modes are covered and things don't
accidentally change in the future. I guess I could have a look into it
myself, but I can't commit to a specific timeline.
NB I have learnt POSIX.1-2024 has been just released to IEEE members and
the corresponding HTML version of The Open Group Base Specifications Issue
8 will follow shortly (~July 21st was named). I guess it will include the
`B' and `b' conversions I mentioned before, both for C usage, obviously,
and supposedly for AWK as well.
Maciej