I've submitted a bug report to the bug-gawk mailing list. I'll post the
URL when the archive updates.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
I've submitted a bug report to the bug-gawk mailing list. I'll post the
URL when the archive updates.
Here's the bug report:
https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00010.html
Keith Thompson <Keith.S.T...@gmail.com> writes:
[...]
I've submitted a bug report to the bug-gawk mailing list. I'll post the URL when the archive updates.Here's the bug report:
https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00010.html
--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
On Sunday, 7 May 2023 at 19:30:47 UTC-6, Keith Thompson wrote:
Keith Thompson <Keith.S.T...@gmail.com> writes:
[...]
I've submitted a bug report to the bug-gawk mailing list. I'll post the URL when the archive updates.Here's the bug report:
https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00010.htmlOk, thanks for the quick and comprehensive response, everybody. I'll use printf as a workaround and keep an eye on the bug report.
--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
On Sunday, 7 May 2023 at 19:30:47 UTC-6, Keith Thompson wrote:
Keith Thompson <Keith.S.T...@gmail.com> writes:
[...]
I've submitted a bug report to the bug-gawk mailing list. I'll post the >> > URL when the archive updates.Here's the bug report:
https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00010.html
Ok, thanks for the quick and comprehensive response, everybody. I'll
use printf as a workaround and keep an eye on the bug report.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
I've submitted a bug report to the bug-gawk mailing list. I'll post the >>> URL when the archive updates.
Here's the bug report:
https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00010.html
And thanks to a reply on the mailing list from Andrew J. Schorr: https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00011.html
I no longer believe this is a bug.
What I should have noticed is that the values for which setting
"OFMT=.15e" *doesn't* produce output in scientific notation are
precisely the values that are mathematically integers.
(typeof (expt 2 300))bignum
(fmt "~e" (expt 2 300))"2.037e90"
(fmt "~e" (expt 2 1000))"1.072e301"
(fmt "~e" (expt 2 2000))** out-of-range floating-point result
large floating-point values are always equal to integers.
Here's what POSIX says: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
A numeric value that is exactly equal to the value of an integer
(see Concepts Derived from the ISO C Standard) shall be converted to
a string by the equivalent of a call to the sprintf function (see
String Functions) with the string "%d" as the fmt argument and the
numeric value being converted as the first and only expr argument.
Ross <chaudhry.ross@gmail.com> writes:
On Sunday, 7 May 2023 at 19:30:47 UTC-6, Keith Thompson wrote:
Keith Thompson <Keith.S.T...@gmail.com> writes:
[...]
I've submitted a bug report to the bug-gawk mailing list. I'll post the >>> > URL when the archive updates.Here's the bug report:
https://lists.gnu.org/archive/html/bug-gawk/2023-05/msg00010.html
Ok, thanks for the quick and comprehensive response, everybody. I'll
use printf as a workaround and keep an eye on the bug report.
See my latest followup. It's not a bug, and using printf is the correct solution, not just a workaround. (One could argue that it's a
misfeature in the awk language, but it's hard to avoid in a language
that distinguishes integers from non-integers by value rather than by
type.)
But printf is in the language, and printf("%e", expr) handles it fine.I thought Keith clarified this issue above. The POSIX spec says that integer values
The OFMT feature just has to treat numeric-valued expressions
using whatever logic that is already making printf("%e", expr) work.
Hi,
On Monday, May 8, 2023 at 3:36:57 AM UTC-4, Kaz Kylheku wrote:
But printf is in the language, and printf("%e", expr) handles it fine.
The OFMT feature just has to treat numeric-valued expressions
using whatever logic that is already making printf("%e", expr) work.
I thought Keith clarified this issue above. The POSIX spec says that integer values
should be converted with an implicit "%d" instead of using CONVFMT.
On 2023-05-08, Andrew Schorr <aschorr@telemetry-investments.com> wrote:
Hi,
On Monday, May 8, 2023 at 3:36:57 AM UTC-4, Kaz Kylheku wrote:
But printf is in the language, and printf("%e", expr) handles it fine.
The OFMT feature just has to treat numeric-valued expressions
using whatever logic that is already making printf("%e", expr) work.
I thought Keith clarified this issue above. The POSIX spec says that
integer values should be converted with an implicit "%d" instead of
using CONVFMT.
The requirement applies to CONVFMT; it isn't written that it applies to
OFMT.
I think it is. Where OFMT applies (in print) the text refers to the conversion that otherwise uses CONVFMT:I think that's right. It also says this:
"All expression arguments shall be taken as strings, being converted if necessary; this conversion shall be as described in Expressions in
awk, with the exception that the printf format in OFMT shall be used
instead of the value in CONVFMT."
and it's the referenced text that has the integer exception with CONVFMT used for other values. Using OFMT in place of CONVFMT in that text does
not remove the exception.
On Monday, May 8, 2023 at 8:59:47 PM UTC-4, Ben Bacarisse wrote:That would *nearly* be true if not for gawk + GMP's lovely behavior with parsing the decimal dot :
I think it is. Where OFMT applies (in print) the text refers to the conversion that otherwise uses CONVFMT:
"All expression arguments shall be taken as strings, being converted if necessary; this conversion shall be as described in Expressions in
awk, with the exception that the printf format in OFMT shall be used instead of the value in CONVFMT."
and it's the referenced text that has the integer exception with CONVFMT used for other values. Using OFMT in place of CONVFMT in that text does not remove the exception.I think that's right. It also says this:
"The intent has been to specify historical practice in almost all cases."
And I think the history is that all implementations of awk have always converted
integral values using the equivalent of "%d", regardless of the CONVFMT or OFMT setting.
Regards,
Andy
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 920 |
Nodes: | 10 (1 / 9) |
Uptime: | 96:17:09 |
Calls: | 12,189 |
Calls today: | 1 |
Files: | 186,527 |
Messages: | 2,237,345 |