(__kernel_standard): Handle log2(0) and log2(x < 0).
authordrepper <drepper>
Wed, 6 Jun 2001 12:46:35 +0000 (12:46 +0000)
committerdrepper <drepper>
Wed, 6 Jun 2001 12:46:35 +0000 (12:46 +0000)
sysdeps/ieee754/k_standard.c

index 2230065..6def34b 100644 (file)
@@ -88,6 +88,8 @@ static double zero = 0.0;     /* used as const */
  *     45-- exp2 underflow
  *     46-- exp10 overflow
  *     47-- exp10 underflow
+ *     48-- log2(0)
+ *     49-- log2(x<0)
  */
 
 
@@ -937,7 +939,42 @@ static double zero = 0.0;  /* used as const */
                        __set_errno (ERANGE);
                }
                break;
-               /* #### Last used is 47/147/247 ### */
+           case 48:
+           case 148:
+           case 248:
+               /* log2(0) */
+               exc.type = SING;
+               exc.name = type < 100 ? "log2" : (type < 200
+                                                  ? "log2f" : "log2l");
+               if (_LIB_VERSION == _SVID_)
+                 exc.retval = -HUGE;
+               else
+                 exc.retval = -HUGE_VAL;
+               if (_LIB_VERSION == _POSIX_)
+                 __set_errno (ERANGE);
+               else if (!matherr(&exc)) {
+                 __set_errno (EDOM);
+               }
+               break;
+           case 49:
+           case 149:
+           case 249:
+               /* log2(x<0) */
+               exc.type = DOMAIN;
+               exc.name = type < 100 ? "log2" : (type < 200
+                                                  ? "log2f" : "log2l");
+               if (_LIB_VERSION == _SVID_)
+                 exc.retval = -HUGE;
+               else
+                 exc.retval = NAN;
+               if (_LIB_VERSION == _POSIX_)
+                 __set_errno (EDOM);
+               else if (!matherr(&exc)) {
+                 __set_errno (EDOM);
+               }
+               break;
+               
+               /* #### Last used is 49/149/249 ### */
        }
        return exc.retval;
 }