Search code examples
cibm-midrange

How to fix this warning messages at compilation on AS400 (C program)?


On iSeries (AS400), in a developer environment, when I compile a C or C++ program (under qsh, using gmake and ixlc / not CRTPGM)

ixlc -c mySource.c

Each time <math.h> is used in a source code, pops this series of warnings:

/QIBM/include/math.h Line 000195 The floating point literal "1.1754943508222875E-38F" is out of range.

/QIBM/include/math.h Line 000208 The floating point literal "1.1754943508222875E-38F" is out of range.

/QIBM/include/math.h Line 000217 The floating point literal "1.1754943508222875E-38F" is out of range.

... plus 10 more

Which corresponds to any line using FLT_MIN , a defined const, from /QIBM/include/float.h .

#define FLT_MIN               1.1754943508222875E-38F

But how can I avoid this warning message which floods my compilation logs.


Solution

  • The defined value for FLT_MIN in your header file has 16 decimal digits. Which is way too much.

    This system uses IEEE 754. So single-precision float values can only have up to 7 decimal digits. (And double-precision value can have 15). The compiler seems to know, but not the std sources.

    Fix the code in the library.

    Take example on other implementations of the std, the code in the library should be:

    #define FLT_EPSILON     1.192093e-07
    #define FLT_MIN         1.175494e-38
    #define FLT_MAX         3.402823e+38
    

    Since this ILE source is protected on iSeries, maybe choose to redirect the symbolic link from /QIBM/include/float.h to another source code of your creation. Not necessarily a member, but an IFS file should do the job.