[previous] 0581 [next] [I] Floating-point constant may be too small to be representable.
Implementation defined REFERENCE - ISO:C90-5.2.4.2.2 Characteristics of Floating Types

A floating-point constant has been used which is probably too small to be represented accurately within its type.

The constants FLT_MIN, DBL_MIN and LDBL_MIN, found in the standard library header file "limits.h", define the minimum normalized positive floating-point numbers that are representable in a given implementation. Typically these values are as specifed in IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985):


  FLT_MIN                 1.17549435E-38F
  DBL_MIN                 2.2250738585072014E-308
  LDBL_MIN                2.2250738585072014E-308L

Message 0581 is generated when constants smaller than these values are identified.

For example:


/*PRQA S 1264,1265,3121,3198,3210,3211,3408,3447 ++*/

extern long double        ld;

void foo(void)
{
   ld = 1.17549435E-38F;                 /* FLT_MIN      */
   ld = 1.17549434E-38F;                 /* Message 0581 */

   ld = 2.2250738585072014E-308;         /* DBL_MIN      */
   ld = 2.2250738585072013E-308;         /* Message 0581 */

   ld = 2.2250738585072014E-308L;        /* LDBL_MIN     */
   ld = 2.2250738585072013E-308L;        /* Message 0581 */
}

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents