[Cfp-interest 1374] Fwd: Re: (SC22WG14.16915) N2380: printf of NaN()

Fred J. Tydeman tydeman at tybor.com
Wed Aug 14 12:59:53 PDT 2019


..................Begin Forwarded Message..................

From: "Fred J. Tydeman" <tydeman at tybor.com>
To: "Jim Thomas" <jaswthomas at sbcglobal.net>
Date: Sun, 11 Aug 2019 22:30:16 -0700 (PDT)
Subject: Re: (SC22WG14.16915) [Cfp-interest 1349] N2380: printf of NaN()

On Sun, 11 Aug 2019 20:54:21 -0700 Jim Thomas wrote:
>
>Good information. Could you test whether these implementations are printing inf or infinity?

They all print "inf".

/* printf of infinity */

#include <stdio.h>
#include <math.h>

int main(void){
 float f = INFINITY;
 double d = INFINITY;
 long double ld = INFINITY;

 (void)printf(" f=%g\n", (double)f);
 (void)printf(" d=%g\n", d);
 (void)printf("ld=%Lg\n", ld);

 (void)printf(" f=%16.12g\n", (double)f);
 (void)printf(" d=%16.12g\n", d);
 (void)printf("ld=%16.12Lg\n", ld);

 (void)printf(" fa=%a\n", (double)f);
 (void)printf(" da=%a\n", d);
 (void)printf("lda=%La\n", ld);

 (void)printf(" fa=%16.12a\n", (double)f);
 (void)printf(" da=%16.12a\n", d);
 (void)printf("lda=%16.12La\n", ld);

 (void)printf(" #fa=%#a\n", (double)f);
 (void)printf(" #da=%#a\n", d);
 (void)printf("#lda=%#La\n", ld);

  return 0;
}



---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.

...................End Forwarded Message..................


---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.



More information about the Cfp-interest mailing list