Print this page




 105 #ifdef _LITTLE_ENDIAN
 106         { 0xffffffff, 0x7fffffff },
 107         { 0x54442d18, 0x400921fb },
 108 #else
 109         { 0x7fffffff, 0xffffffff },
 110         { 0x400921fb, 0x54442d18 },
 111 #endif
 112 };
 113 
 114 #define NaN     C[0].d
 115 #define PI_RZ   C[1].d
 116 
 117 #define __HI(x) ((unsigned *)&x)[HIWORD]
 118 #define __LO(x) ((unsigned *)&x)[LOWORD]
 119 #undef  Inf
 120 #define Inf     HUGE_VAL
 121 
 122 double
 123 _SVID_libm_err(double x, double y, int type) {
 124         struct exception        exc;
 125         double                  t, w, ieee_retval;
 126         enum version            lib_version = _lib_version;
 127         int                     iy;
 128 
 129         /* force libm_ieee behavior in SUSv3 mode */
 130         if ((__xpg6 & _C99SUSv3_math_errexcept) != 0)
 131                 lib_version = libm_ieee;
 132         if (lib_version == c_issue_4) {
 133                 (void) fflush(stdout);
 134         }
 135         exc.arg1 = x;
 136         exc.arg2 = y;
 137         switch (type) {
 138         case 1:
 139                 /* acos(|x|>1) */
 140                 exc.type = DOMAIN;
 141                 exc.name = "acos";
 142                 ieee_retval = setexception(3, 1.0);
 143                 exc.retval = 0.0;
 144                 if (lib_version == strict_ansi) {
 145                         errno = EDOM;


 839                         exc.retval = HUGE_VAL;
 840                 if (lib_version == strict_ansi) {
 841                         errno = EDOM;
 842                 } else if (!matherr(&exc)) {
 843                         if (lib_version == c_issue_4) {
 844                                 (void) write(2, "gamma: SING error\n", 18);
 845                         }
 846                         errno = EDOM;
 847                 }
 848                 break;
 849         case 42:
 850                 /* pow(NaN,0.0) */
 851                 /* error if lib_version == c_issue_4 or ansi_1 */
 852                 exc.type = DOMAIN;
 853                 exc.name = "pow";
 854                 exc.retval = x;
 855                 ieee_retval = 1.0;
 856                 if (lib_version == strict_ansi) {
 857                         exc.retval = 1.0;
 858                 } else if (!matherr(&exc)) {
 859                         switch (lib_version) {
 860                         case c_issue_4:
 861                         case ansi_1:
 862                                 errno = EDOM;
 863                         }
 864                 }
 865                 break;
 866         case 43:
 867                 /* log1p(-1) */
 868                 exc.type = SING;
 869                 exc.name = "log1p";
 870                 ieee_retval = setexception(0, -1.0);
 871                 if (lib_version == c_issue_4)
 872                         exc.retval = -HUGE;
 873                 else
 874                         exc.retval = -HUGE_VAL;
 875                 if (lib_version == strict_ansi) {
 876                         errno = ERANGE;
 877                 } else if (!matherr(&exc)) {
 878                         if (lib_version == c_issue_4) {
 879                                 (void) write(2, "log1p: SING error\n", 18);
 880                                 errno = EDOM;
 881                         } else {
 882                                 errno = ERANGE;
 883                         }




 105 #ifdef _LITTLE_ENDIAN
 106         { 0xffffffff, 0x7fffffff },
 107         { 0x54442d18, 0x400921fb },
 108 #else
 109         { 0x7fffffff, 0xffffffff },
 110         { 0x400921fb, 0x54442d18 },
 111 #endif
 112 };
 113 
 114 #define NaN     C[0].d
 115 #define PI_RZ   C[1].d
 116 
 117 #define __HI(x) ((unsigned *)&x)[HIWORD]
 118 #define __LO(x) ((unsigned *)&x)[LOWORD]
 119 #undef  Inf
 120 #define Inf     HUGE_VAL
 121 
 122 double
 123 _SVID_libm_err(double x, double y, int type) {
 124         struct exception        exc;
 125         double                  t, w, ieee_retval = 0;
 126         enum version            lib_version = _lib_version;
 127         int                     iy;
 128 
 129         /* force libm_ieee behavior in SUSv3 mode */
 130         if ((__xpg6 & _C99SUSv3_math_errexcept) != 0)
 131                 lib_version = libm_ieee;
 132         if (lib_version == c_issue_4) {
 133                 (void) fflush(stdout);
 134         }
 135         exc.arg1 = x;
 136         exc.arg2 = y;
 137         switch (type) {
 138         case 1:
 139                 /* acos(|x|>1) */
 140                 exc.type = DOMAIN;
 141                 exc.name = "acos";
 142                 ieee_retval = setexception(3, 1.0);
 143                 exc.retval = 0.0;
 144                 if (lib_version == strict_ansi) {
 145                         errno = EDOM;


 839                         exc.retval = HUGE_VAL;
 840                 if (lib_version == strict_ansi) {
 841                         errno = EDOM;
 842                 } else if (!matherr(&exc)) {
 843                         if (lib_version == c_issue_4) {
 844                                 (void) write(2, "gamma: SING error\n", 18);
 845                         }
 846                         errno = EDOM;
 847                 }
 848                 break;
 849         case 42:
 850                 /* pow(NaN,0.0) */
 851                 /* error if lib_version == c_issue_4 or ansi_1 */
 852                 exc.type = DOMAIN;
 853                 exc.name = "pow";
 854                 exc.retval = x;
 855                 ieee_retval = 1.0;
 856                 if (lib_version == strict_ansi) {
 857                         exc.retval = 1.0;
 858                 } else if (!matherr(&exc)) {
 859                         if ((lib_version == c_issue_4) || (lib_version == ansi_1))


 860                                 errno = EDOM;

 861                 }
 862                 break;
 863         case 43:
 864                 /* log1p(-1) */
 865                 exc.type = SING;
 866                 exc.name = "log1p";
 867                 ieee_retval = setexception(0, -1.0);
 868                 if (lib_version == c_issue_4)
 869                         exc.retval = -HUGE;
 870                 else
 871                         exc.retval = -HUGE_VAL;
 872                 if (lib_version == strict_ansi) {
 873                         errno = ERANGE;
 874                 } else if (!matherr(&exc)) {
 875                         if (lib_version == c_issue_4) {
 876                                 (void) write(2, "log1p: SING error\n", 18);
 877                                 errno = EDOM;
 878                         } else {
 879                                 errno = ERANGE;
 880                         }