-/* @(#)k_standard.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $";
-#endif
-
-#include "math.h"
+#include <math.h>
#include "math_private.h"
#include <errno.h>
+#ifndef _IEEE_LIBM
+
#ifndef _USE_WRITE
#include <stdio.h> /* fputs(), stderr */
#define WRITE2(u,v) fputs(u, stderr)
#undef fflush
#endif /* !defined(_USE_WRITE) */
-#ifdef __STDC__
static const double zero = 0.0; /* used as const */
-#else
-static double zero = 0.0; /* used as const */
-#endif
-/*
+/*
* Standard conformance (non-IEEE) on exception cases.
* Mapping:
* 1 -- acos(|x|>1)
* 20-- pow(0.0,0.0)
* 21-- pow(x,y) overflow
* 22-- pow(x,y) underflow
- * 23-- pow(0,negative)
+ * 23-- pow(0,negative)
* 24-- pow(neg,non-integral)
* 25-- sinh(finite) overflow
* 26-- sqrt(negative)
* 42-- pow(NaN,0.0)
*/
-
-#ifdef __STDC__
- double __kernel_standard(double x, double y, int type)
-#else
- double __kernel_standard(x,y,type)
- double x,y; int type;
-#endif
+double __kernel_standard(double x, double y, int type)
{
struct exception exc;
-#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
+#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
#define HUGE_VAL inf
double inf = 0.0;
/* 0**neg */
exc.type = DOMAIN;
exc.name = type < 100 ? "pow" : "powf";
- if (_LIB_VERSION == _SVID_)
+ if (_LIB_VERSION == _SVID_)
exc.retval = zero;
else
exc.retval = -HUGE_VAL;
/* neg**non-integral */
exc.type = DOMAIN;
exc.name = type < 100 ? "pow" : "powf";
- if (_LIB_VERSION == _SVID_)
+ if (_LIB_VERSION == _SVID_)
exc.retval = zero;
- else
+ else
exc.retval = zero/zero; /* X/Open allow NaN */
- if (_LIB_VERSION == _POSIX_)
+ if (_LIB_VERSION == _POSIX_)
errno = EDOM;
else if (!matherr(&exc)) {
if (_LIB_VERSION == _SVID_) {
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 35:
case 135:
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 36:
case 136:
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 37:
case 137:
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 38:
case 138:
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 39:
case 139:
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 40:
case 140:
}
break;
}
- return exc.retval;
+ return exc.retval;
}
+#endif /* _IEEE_LIBM */