NetBSD-Bugs archive

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

Re: bin/59749: awk bad test to see if printf supports the %a format



On 2025-11-06 8:35 am, trevor.zacks%btopenworld.com@localhost wrote:

Will never match "0x1.5p+5" unless the default printf() precision is 1

I don't understand this statement; there precision in printf(3) is fixed
by the c standard and baked into libc. This program:

#include <stdio.h>

int
main(void)
{
        char xbuf[100];
        snprintf(xbuf, sizeof(xbuf), "%a", 42.0);
        printf("%s\n", xbuf);
        return 0;
}

prints 0x1.5p+5, so the code as is in awk works?

christos


Home | Main Index | Thread Index | Old Index