Defect Report #284

Previous Defect Report < - > Next Defect Report

Submitter: Douglas Walls (US)
Submission Date: 2003-02-11
Source: J11
Reference Document: ISO/IEC WG14 N995
Version: 1.2
Date: 2004-03-05
Subject: Does <math.h> define INT_MIN and INT_MAX?


<math.h> defines macros in terms of INT_MIN and INT_MAX. <math.h> defines functions returning the value of INT_MIN. It is unclear if inclusion of <math.h> defines INT_MIN and INT_MAX or also includes <limits.h>.


The description of <math.h> in C99 (section 7.12) says that the macros FP_ILOGB0 and FP_ILOGBNAN are defined in <math.h> with values, respectively INT_MIN or -INT_MAX and INT_MAX or INT_MIN, but never says that INT_MIN and INT_MAX are defined in <math.h>.

The synopsis of The ilogb function says:

        #include <math.h>
        int ilogb(double x);
        int ilogbf(float x);
        int ilogbl(long double x);
The description of The ilogb functions says "if x is infinite they compute the value INT_MAX;".

Does this mean that <math.h> includes <limits.h>?

Does this mean that <math.h> defines INT_MIN and INT_MAX?

Suggested Technical Corrigendum

Committee Response

No Standard library header includes another Standard library header. The header <math.h> does not define INT_MIN or INT_MAX. A program that wants to check the return value for equality with one of these macros must include <limits.h>.

Previous Defect Report < - > Next Defect Report