Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libm/src/k_standard.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libm/src/k_standard.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.11 retrieving revision 1.12 diff -u -p -r1.11 -r1.12 --- src/lib/libm/src/k_standard.c 2002/05/26 22:01:53 1.11 +++ src/lib/libm/src/k_standard.c 2005/07/21 16:58:39 1.12 @@ -12,7 +12,7 @@ #include #if defined(LIBM_SCCS) && !defined(lint) -__RCSID("$NetBSD: k_standard.c,v 1.11 2002/05/26 22:01:53 wiz Exp $"); +__RCSID("$NetBSD: k_standard.c,v 1.12 2005/07/21 16:58:39 christos Exp $"); #endif #include "math.h" @@ -75,6 +75,8 @@ static const double zero = 0.0; /* used * 40-- gamma(finite) overflow * 41-- gamma(-integer) * 42-- pow(NaN,0.0) + * 48-- log2(0) + * 49-- log2(x<0) */ @@ -770,6 +772,42 @@ __kernel_standard(double x, double y, in errno = EDOM; } break; + case 48: + case 148: + /* log2(0) */ + exc.type = SING; + exc.name = type < 100 ? "log2" : "log2f"; + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + errno = ERANGE; + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("log2: SING error\n", 18); + } + errno = EDOM; + } + break; + case 49: + case 149: + /* log2(x<0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "log2" : "log2f"; + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + errno = EDOM; + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("log2: DOMAIN error\n", 20); + } + errno = EDOM; + } + break; } return exc.retval; }