summary refs log tree commit diff
path: root/sysdeps/ieee754/k_standard.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/k_standard.c')
-rw-r--r--sysdeps/ieee754/k_standard.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index 22300652e9..6def34bc0c 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -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;
 }