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



The following reply was made to PR bin/59749; it has been noted by GNATS.

From: Christos Zoulas <christos%zoulas.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/59749: awk bad test to see if printf supports the %a format
Date: Thu, 06 Nov 2025 09:44:07 -0500

 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