Annotation of researchv10no/cmd/lcc/ph/d41c.c, revision 1.1

1.1     ! root        1: /* The Plum Hall Validation Suite for C
        !             2:  * Unpublished copyright (c) 1986-1991, Chiron Systems Inc and Plum Hall Inc.
        !             3:  * VERSION: 4
        !             4:  * DATE: 1993-01-01
        !             5:  * The "ANSI" mode of this suite corresponds to official ANSI C, X3.159-1989.
        !             6:  * As per your license agreement, your distribution is not to be moved or copied outside the Designated Site
        !             7:  * without specific permission from Plum Hall Inc.
        !             8:  */
        !             9: 
        !            10: #define LIB_TEST 1
        !            11: #include "defs.h"
        !            12: #if !ANSI || !HAS_PROTOTYPES
        !            13: #define SKIP41 1
        !            14: #endif
        !            15: 
        !            16: #include "flags.h"
        !            17: #ifndef SKIP41
        !            18: #include <float.h>
        !            19: /*
        !            20:  * 4.1.4 - Limits <float.h>
        !            21:  */
        !            22: void d41_4b()
        !            23:        {
        !            24:        Filename = "d41c.c";
        !            25: 
        !            26:        /* FLT_RADIX must be a restricted constant expression.
        !            27:         * All the others need not be constant expressions (ANSI8706).
        !            28:         */
        !            29: #if FLT_RADIX < 2
        !            30:        complain(__LINE__);
        !            31: #endif
        !            32: 
        !            33:        checkthat( - __LINE__, FLT_ROUNDS >= -1);       /* other values of FLT_ROUNDS may be implem-def */
        !            34:        {
        !            35:                double d1, d2, d3;
        !            36: 
        !            37:                d1 = dvalue(1.);
        !            38:                d2 = dvalue(2 * DBL_EPSILON / 3);
        !            39:                d3 = d1 + d2;   /* should cause rounding into lowest-order digit */
        !            40:                     if (FLT_ROUNDS == 0 /* toward zero    */ && d3  > d1) complain(__LINE__);
        !            41:                else if (FLT_ROUNDS == 1 /* to nearest     */ && d3 <= d1) complain(__LINE__);
        !            42:                else if (FLT_ROUNDS == 2 /* toward pos inf */ && d3 <= d1) complain(__LINE__);
        !            43:                else if (FLT_ROUNDS == 3 /* to neg inf     */ && d3  > d1) complain(__LINE__);
        !            44: 
        !            45:                d1 = -dvalue(1.);
        !            46:                d2 = -dvalue(2 * DBL_EPSILON / 3);
        !            47:                d3 = d1 + d2;   /* should cause rounding into lowest-order digit */
        !            48:                     if (FLT_ROUNDS == 0 /* toward zero    */ && d3  < d1) complain(__LINE__);
        !            49:                else if (FLT_ROUNDS == 1 /* to nearest     */ && d3 >= d1) complain(__LINE__);
        !            50:                else if (FLT_ROUNDS == 2 /* toward pos inf */ && d3  < d1) complain(__LINE__);
        !            51:                else if (FLT_ROUNDS == 3 /* to neg inf     */ && d3 >= d1) complain(__LINE__);
        !            52:        }
        !            53: 
        !            54:        checkthat(__LINE__, FLT_MANT_DIG > 0);
        !            55:        checkthat(__LINE__, DBL_MANT_DIG > 0);
        !            56:        checkthat(__LINE__, LDBL_MANT_DIG > 0);
        !            57:        checkthat(__LINE__, FLT_DIG >= 6);
        !            58:        checkthat(__LINE__, DBL_DIG >= (ANSI8703 ? 10 : 6));
        !            59:        checkthat(__LINE__, LDBL_DIG >= (ANSI8703 ? 10 : 6));
        !            60:        checkthat(__LINE__, FLT_MIN_EXP < 0);
        !            61:        checkthat(__LINE__, DBL_MIN_EXP < 0);
        !            62:        checkthat(__LINE__, LDBL_MIN_EXP < 0);
        !            63:        checkthat(__LINE__, FLT_MIN_10_EXP <= -37);
        !            64:        checkthat(__LINE__, DBL_MIN_10_EXP <= -37);
        !            65:        checkthat(__LINE__, LDBL_MIN_10_EXP <= -37);
        !            66:        checkthat(__LINE__, FLT_MAX_EXP > 0);
        !            67:        checkthat(__LINE__, DBL_MAX_EXP > 0);
        !            68:        checkthat(__LINE__, LDBL_MAX_EXP > 0);
        !            69:        checkthat(__LINE__, FLT_MAX_10_EXP >= 37);
        !            70:        checkthat(__LINE__, DBL_MAX_10_EXP >= 37);
        !            71:        checkthat(__LINE__, LDBL_MAX_10_EXP >= 37);
        !            72:        checkthat(__LINE__, FLT_MAX >= 1E+37);
        !            73:        checkthat(__LINE__, DBL_MAX >= 1E+37);
        !            74:        checkthat(__LINE__, LDBL_MAX >= 1E+37);
        !            75:        checkthat(__LINE__, FLT_EPSILON <= 1E-5);
        !            76:        checkthat(__LINE__, DBL_EPSILON <= (ANSI8703 ? 1E-9 : 1E-5));
        !            77:        checkthat(__LINE__, LDBL_EPSILON <= (ANSI8703 ? 1E-9 : 1E-5));
        !            78:        checkthat(__LINE__, FLT_MIN <= 1E-37);
        !            79:        checkthat(__LINE__, DBL_MIN <= 1E-37);
        !            80:        checkthat(__LINE__, LDBL_MIN <= 1E-37);
        !            81: 
        !            82:        /* check that all names are really macros */
        !            83: #if !defined(FLT_MANT_DIG) || !defined(DBL_MANT_DIG) || !defined(LDBL_MANT_DIG)
        !            84:        complain(__LINE__);
        !            85: #endif
        !            86: #if !defined(FLT_DIG) || !defined(DBL_DIG) || !defined(LDBL_DIG)
        !            87:        complain(__LINE__);
        !            88: #endif
        !            89: #if !defined(FLT_MIN_EXP) || !defined(DBL_MIN_EXP) || !defined(LDBL_MIN_EXP)
        !            90:        complain(__LINE__);
        !            91: #endif
        !            92: #if !defined(FLT_MIN_10_EXP) || !defined(DBL_MIN_10_EXP) || !defined(LDBL_MIN_10_EXP)
        !            93:        complain(__LINE__);
        !            94: #endif
        !            95: #if !defined(FLT_MAX_EXP) || !defined(DBL_MAX_EXP) || !defined(LDBL_MAX_EXP)
        !            96:        complain(__LINE__);
        !            97: #endif
        !            98: #if !defined(FLT_MAX_10_EXP) || !defined(DBL_MAX_10_EXP) || !defined(LDBL_MAX_10_EXP)
        !            99:        complain(__LINE__);
        !           100: #endif
        !           101: 
        !           102: 
        !           103: #if !defined(FLT_MAX) || !defined(DBL_MAX) || !defined(LDBL_MAX)
        !           104:        complain(__LINE__);
        !           105: #endif
        !           106: #if !defined(FLT_EPSILON) || !defined(DBL_EPSILON) || !defined(LDBL_EPSILON)
        !           107:        complain(__LINE__);
        !           108: #endif
        !           109: #if !defined(FLT_MIN) || !defined(DBL_MIN) || !defined(LDBL_MIN)
        !           110:        complain(__LINE__);
        !           111: #endif
        !           112:        }
        !           113: #else
        !           114: int skp41c = 1;        /* must have one def */
        !           115: #endif /* SKIP41 */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.