NetBSD-Bugs archive

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

standards/40695: C99 violation: Macro NAN in /usr/include/math.h in not constant.

>Number:         40695
>Category:       standards
>Synopsis:       C99 violation: Macro NAN in /usr/include/math.h in not 
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 19 22:00:00 +0000 2009
>Originator:     Jochen Kunz
>Release:        5.0_RC1
The NetBSD Foundation
NetBSD MissSophie 5.0_RC1 NetBSD 5.0_RC1 (MissSophie) #19: Thu Feb 12 22:24:31 
CET 2009  jkunz@MissSophie:/usr/src/build/MissSophie i386
The macro NAN (Not A Number) in /usr/include/math.h expands to a variable and 
is not constant.

C99 (, section 7.12.5 
"Mathematics <math.h>", page 213 requires:

The macro
is defined if and only if the implementation supports quiet NaNs for the float 
type. It expands to a constant expression of type float representing a quiet 

The folowing program fails to compile:

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

double f1 = NAN;

main(int argc, char** argv) {
        printf( "NAN: %f\n", f1);
        exit( EXIT_SUCCESS);

Home | Main Index | Thread Index | Old Index