|
Packit Service |
82fcde |
/* @(#)k_standard.c 5.1 93/09/24 */
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* ====================================================
|
|
Packit Service |
82fcde |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
Packit Service |
82fcde |
*
|
|
Packit Service |
82fcde |
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
Packit Service |
82fcde |
* Permission to use, copy, modify, and distribute this
|
|
Packit Service |
82fcde |
* software is freely granted, provided that this notice
|
|
Packit Service |
82fcde |
* is preserved.
|
|
Packit Service |
82fcde |
* ====================================================
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if defined(LIBM_SCCS) && !defined(lint)
|
|
Packit Service |
82fcde |
static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $";
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <math.h>
|
|
Packit Service |
82fcde |
#include <math_private.h>
|
|
Packit Service |
82fcde |
#include <math-svid-compat.h>
|
|
Packit Service |
82fcde |
#include <errno.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <assert.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if LIBM_SVID_COMPAT
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# ifndef _USE_WRITE
|
|
Packit Service |
82fcde |
# include <stdio.h> /* fputs(), stderr */
|
|
Packit Service |
82fcde |
# define WRITE2(u,v) fputs(u, stderr)
|
|
Packit Service |
82fcde |
# else /* !defined(_USE_WRITE) */
|
|
Packit Service |
82fcde |
# include <unistd.h> /* write */
|
|
Packit Service |
82fcde |
# define WRITE2(u,v) write(2, u, v)
|
|
Packit Service |
82fcde |
# undef fflush
|
|
Packit Service |
82fcde |
# endif /* !defined(_USE_WRITE) */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* XXX gcc versions until now don't delay the 0.0/0.0 division until
|
|
Packit Service |
82fcde |
runtime but produce NaN at compile time. This is wrong since the
|
|
Packit Service |
82fcde |
exceptions are not set correctly. */
|
|
Packit Service |
82fcde |
# if 0
|
|
Packit Service |
82fcde |
static const double zero = 0.0; /* used as const */
|
|
Packit Service |
82fcde |
# else
|
|
Packit Service |
82fcde |
static double zero = 0.0; /* used as const */
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* Standard conformance (non-IEEE) on exception cases.
|
|
Packit Service |
82fcde |
* Mapping:
|
|
Packit Service |
82fcde |
* 1 -- acos(|x|>1)
|
|
Packit Service |
82fcde |
* 2 -- asin(|x|>1)
|
|
Packit Service |
82fcde |
* 3 -- atan2(+-0,+-0)
|
|
Packit Service |
82fcde |
* 4 -- hypot overflow
|
|
Packit Service |
82fcde |
* 5 -- cosh overflow
|
|
Packit Service |
82fcde |
* 6 -- exp overflow
|
|
Packit Service |
82fcde |
* 7 -- exp underflow
|
|
Packit Service |
82fcde |
* 8 -- y0(0)
|
|
Packit Service |
82fcde |
* 9 -- y0(-ve)
|
|
Packit Service |
82fcde |
* 10-- y1(0)
|
|
Packit Service |
82fcde |
* 11-- y1(-ve)
|
|
Packit Service |
82fcde |
* 12-- yn(0)
|
|
Packit Service |
82fcde |
* 13-- yn(-ve)
|
|
Packit Service |
82fcde |
* 14-- lgamma(finite) overflow
|
|
Packit Service |
82fcde |
* 15-- lgamma(-integer)
|
|
Packit Service |
82fcde |
* 16-- log(0)
|
|
Packit Service |
82fcde |
* 17-- log(x<0)
|
|
Packit Service |
82fcde |
* 18-- log10(0)
|
|
Packit Service |
82fcde |
* 19-- log10(x<0)
|
|
Packit Service |
82fcde |
* 21-- pow(x,y) overflow
|
|
Packit Service |
82fcde |
* 22-- pow(x,y) underflow
|
|
Packit Service |
82fcde |
* 23-- pow(0,negative)
|
|
Packit Service |
82fcde |
* 24-- pow(neg,non-integral)
|
|
Packit Service |
82fcde |
* 25-- sinh(finite) overflow
|
|
Packit Service |
82fcde |
* 26-- sqrt(negative)
|
|
Packit Service |
82fcde |
* 27-- fmod(x,0)
|
|
Packit Service |
82fcde |
* 28-- remainder(x,0)
|
|
Packit Service |
82fcde |
* 29-- acosh(x<1)
|
|
Packit Service |
82fcde |
* 30-- atanh(|x|>1)
|
|
Packit Service |
82fcde |
* 31-- atanh(|x|=1)
|
|
Packit Service |
82fcde |
* 32-- scalb overflow
|
|
Packit Service |
82fcde |
* 33-- scalb underflow
|
|
Packit Service |
82fcde |
* 34-- j0(|x|>X_TLOSS)
|
|
Packit Service |
82fcde |
* 35-- y0(x>X_TLOSS)
|
|
Packit Service |
82fcde |
* 36-- j1(|x|>X_TLOSS)
|
|
Packit Service |
82fcde |
* 37-- y1(x>X_TLOSS)
|
|
Packit Service |
82fcde |
* 38-- jn(|x|>X_TLOSS, n)
|
|
Packit Service |
82fcde |
* 39-- yn(x>X_TLOSS, n)
|
|
Packit Service |
82fcde |
* 40-- tgamma(finite) overflow
|
|
Packit Service |
82fcde |
* 41-- tgamma(-integer)
|
|
Packit Service |
82fcde |
* 43-- +0**neg
|
|
Packit Service |
82fcde |
* 44-- exp2 overflow
|
|
Packit Service |
82fcde |
* 45-- exp2 underflow
|
|
Packit Service |
82fcde |
* 46-- exp10 overflow
|
|
Packit Service |
82fcde |
* 47-- exp10 underflow
|
|
Packit Service |
82fcde |
* 48-- log2(0)
|
|
Packit Service |
82fcde |
* 49-- log2(x<0)
|
|
Packit Service |
82fcde |
* 50-- tgamma(+-0)
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
double
|
|
Packit Service |
82fcde |
__kernel_standard(double x, double y, int type)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
struct exception exc;
|
|
Packit Service |
82fcde |
# ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
|
|
Packit Service |
82fcde |
# define HUGE_VAL inf
|
|
Packit Service |
82fcde |
double inf = 0.0;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* The SVID struct exception uses a field "char *name;". */
|
|
Packit Service |
82fcde |
# define CSTR(func) ((char *) (type < 100 \
|
|
Packit Service |
82fcde |
? func \
|
|
Packit Service |
82fcde |
: (type < 200 ? func "f" : func "l")))
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# ifdef _USE_WRITE
|
|
Packit Service |
82fcde |
(void) fflush(stdout);
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
exc.arg1 = x;
|
|
Packit Service |
82fcde |
exc.arg2 = y;
|
|
Packit Service |
82fcde |
switch(type) {
|
|
Packit Service |
82fcde |
case 1:
|
|
Packit Service |
82fcde |
case 101:
|
|
Packit Service |
82fcde |
case 201:
|
|
Packit Service |
82fcde |
/* acos(|x|>1) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("acos");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if(_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("acos: DOMAIN error\n", 19);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 2:
|
|
Packit Service |
82fcde |
case 102:
|
|
Packit Service |
82fcde |
case 202:
|
|
Packit Service |
82fcde |
/* asin(|x|>1) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("asin");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if(_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if(_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("asin: DOMAIN error\n", 19);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 3:
|
|
Packit Service |
82fcde |
case 103:
|
|
Packit Service |
82fcde |
case 203:
|
|
Packit Service |
82fcde |
/* atan2(+-0,+-0) */
|
|
Packit Service |
82fcde |
exc.arg1 = y;
|
|
Packit Service |
82fcde |
exc.arg2 = x;
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("atan2");
|
|
Packit Service |
82fcde |
assert (_LIB_VERSION == _SVID_);
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
if(_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if(_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("atan2: DOMAIN error\n", 20);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 4:
|
|
Packit Service |
82fcde |
case 104:
|
|
Packit Service |
82fcde |
case 204:
|
|
Packit Service |
82fcde |
/* hypot(finite,finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("hypot");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 5:
|
|
Packit Service |
82fcde |
case 105:
|
|
Packit Service |
82fcde |
case 205:
|
|
Packit Service |
82fcde |
/* cosh(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("cosh");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 6:
|
|
Packit Service |
82fcde |
case 106:
|
|
Packit Service |
82fcde |
case 206:
|
|
Packit Service |
82fcde |
/* exp(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("exp");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 7:
|
|
Packit Service |
82fcde |
case 107:
|
|
Packit Service |
82fcde |
case 207:
|
|
Packit Service |
82fcde |
/* exp(finite) underflow */
|
|
Packit Service |
82fcde |
exc.type = UNDERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("exp");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 8:
|
|
Packit Service |
82fcde |
case 108:
|
|
Packit Service |
82fcde |
case 208:
|
|
Packit Service |
82fcde |
/* y0(0) = -inf */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN; /* should be SING for IEEE */
|
|
Packit Service |
82fcde |
exc.name = CSTR ("y0");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("y0: DOMAIN error\n", 17);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 9:
|
|
Packit Service |
82fcde |
case 109:
|
|
Packit Service |
82fcde |
case 209:
|
|
Packit Service |
82fcde |
/* y0(x<0) = NaN */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("y0");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("y0: DOMAIN error\n", 17);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 10:
|
|
Packit Service |
82fcde |
case 110:
|
|
Packit Service |
82fcde |
case 210:
|
|
Packit Service |
82fcde |
/* y1(0) = -inf */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN; /* should be SING for IEEE */
|
|
Packit Service |
82fcde |
exc.name = CSTR ("y1");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("y1: DOMAIN error\n", 17);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 11:
|
|
Packit Service |
82fcde |
case 111:
|
|
Packit Service |
82fcde |
case 211:
|
|
Packit Service |
82fcde |
/* y1(x<0) = NaN */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("y1");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("y1: DOMAIN error\n", 17);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 12:
|
|
Packit Service |
82fcde |
case 112:
|
|
Packit Service |
82fcde |
case 212:
|
|
Packit Service |
82fcde |
/* yn(n,0) = -inf */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN; /* should be SING for IEEE */
|
|
Packit Service |
82fcde |
exc.name = CSTR ("yn");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = ((x < 0 && ((int) x & 1) != 0)
|
|
Packit Service |
82fcde |
? HUGE_VAL
|
|
Packit Service |
82fcde |
: -HUGE_VAL);
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("yn: DOMAIN error\n", 17);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 13:
|
|
Packit Service |
82fcde |
case 113:
|
|
Packit Service |
82fcde |
case 213:
|
|
Packit Service |
82fcde |
/* yn(x<0) = NaN */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("yn");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("yn: DOMAIN error\n", 17);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 14:
|
|
Packit Service |
82fcde |
case 114:
|
|
Packit Service |
82fcde |
case 214:
|
|
Packit Service |
82fcde |
/* lgamma(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("lgamma");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 15:
|
|
Packit Service |
82fcde |
case 115:
|
|
Packit Service |
82fcde |
case 215:
|
|
Packit Service |
82fcde |
/* lgamma(-integer) or lgamma(0) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("lgamma");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("lgamma: SING error\n", 19);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 16:
|
|
Packit Service |
82fcde |
case 116:
|
|
Packit Service |
82fcde |
case 216:
|
|
Packit Service |
82fcde |
/* log(0) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("log");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("log: SING error\n", 16);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 17:
|
|
Packit Service |
82fcde |
case 117:
|
|
Packit Service |
82fcde |
case 217:
|
|
Packit Service |
82fcde |
/* log(x<0) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("log");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("log: DOMAIN error\n", 18);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 18:
|
|
Packit Service |
82fcde |
case 118:
|
|
Packit Service |
82fcde |
case 218:
|
|
Packit Service |
82fcde |
/* log10(0) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("log10");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("log10: SING error\n", 18);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 19:
|
|
Packit Service |
82fcde |
case 119:
|
|
Packit Service |
82fcde |
case 219:
|
|
Packit Service |
82fcde |
/* log10(x<0) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("log10");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("log10: DOMAIN error\n", 20);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 21:
|
|
Packit Service |
82fcde |
case 121:
|
|
Packit Service |
82fcde |
case 221:
|
|
Packit Service |
82fcde |
/* pow(x,y) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("pow");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
y *= 0.5;
|
|
Packit Service |
82fcde |
if(x
|
|
Packit Service |
82fcde |
} else {
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
y *= 0.5;
|
|
Packit Service |
82fcde |
if(x
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 22:
|
|
Packit Service |
82fcde |
case 122:
|
|
Packit Service |
82fcde |
case 222:
|
|
Packit Service |
82fcde |
/* pow(x,y) underflow */
|
|
Packit Service |
82fcde |
exc.type = UNDERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("pow");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
y *= 0.5;
|
|
Packit Service |
82fcde |
if (x < zero && __rint (y) != y)
|
|
Packit Service |
82fcde |
exc.retval = -zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 23:
|
|
Packit Service |
82fcde |
case 123:
|
|
Packit Service |
82fcde |
case 223:
|
|
Packit Service |
82fcde |
/* -0**neg */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("pow");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 43:
|
|
Packit Service |
82fcde |
case 143:
|
|
Packit Service |
82fcde |
case 243:
|
|
Packit Service |
82fcde |
/* +0**neg */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("pow");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 24:
|
|
Packit Service |
82fcde |
case 124:
|
|
Packit Service |
82fcde |
case 224:
|
|
Packit Service |
82fcde |
/* neg**non-integral */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("pow");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = zero/zero; /* X/Open allow NaN */
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 25:
|
|
Packit Service |
82fcde |
case 125:
|
|
Packit Service |
82fcde |
case 225:
|
|
Packit Service |
82fcde |
/* sinh(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("sinh");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = ( (x>zero) ? HUGE : -HUGE);
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL);
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 26:
|
|
Packit Service |
82fcde |
case 126:
|
|
Packit Service |
82fcde |
case 226:
|
|
Packit Service |
82fcde |
/* sqrt(x<0) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("sqrt");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = zero/zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("sqrt: DOMAIN error\n", 19);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 27:
|
|
Packit Service |
82fcde |
case 127:
|
|
Packit Service |
82fcde |
case 227:
|
|
Packit Service |
82fcde |
/* fmod(x,0) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("fmod");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = x;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = zero/zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("fmod: DOMAIN error\n", 20);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 28:
|
|
Packit Service |
82fcde |
case 128:
|
|
Packit Service |
82fcde |
case 228:
|
|
Packit Service |
82fcde |
/* remainder(x,0) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("remainder");
|
|
Packit Service |
82fcde |
exc.retval = zero/zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("remainder: DOMAIN error\n", 24);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 29:
|
|
Packit Service |
82fcde |
case 129:
|
|
Packit Service |
82fcde |
case 229:
|
|
Packit Service |
82fcde |
/* acosh(x<1) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("acosh");
|
|
Packit Service |
82fcde |
exc.retval = zero/zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("acosh: DOMAIN error\n", 20);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 30:
|
|
Packit Service |
82fcde |
case 130:
|
|
Packit Service |
82fcde |
case 230:
|
|
Packit Service |
82fcde |
/* atanh(|x|>1) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("atanh");
|
|
Packit Service |
82fcde |
exc.retval = zero/zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("atanh: DOMAIN error\n", 20);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 31:
|
|
Packit Service |
82fcde |
case 131:
|
|
Packit Service |
82fcde |
case 231:
|
|
Packit Service |
82fcde |
/* atanh(|x|=1) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("atanh");
|
|
Packit Service |
82fcde |
exc.retval = x/zero; /* sign(x)*inf */
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("atanh: SING error\n", 18);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 32:
|
|
Packit Service |
82fcde |
case 132:
|
|
Packit Service |
82fcde |
case 232:
|
|
Packit Service |
82fcde |
/* scalb overflow; SVID also returns +-HUGE_VAL */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("scalb");
|
|
Packit Service |
82fcde |
exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 33:
|
|
Packit Service |
82fcde |
case 133:
|
|
Packit Service |
82fcde |
case 233:
|
|
Packit Service |
82fcde |
/* scalb underflow */
|
|
Packit Service |
82fcde |
exc.type = UNDERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("scalb");
|
|
Packit Service |
82fcde |
exc.retval = __copysign(zero,x);
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 34:
|
|
Packit Service |
82fcde |
case 134:
|
|
Packit Service |
82fcde |
case 234:
|
|
Packit Service |
82fcde |
/* j0(|x|>X_TLOSS) */
|
|
Packit Service |
82fcde |
exc.type = TLOSS;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("j0");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2(exc.name, 2);
|
|
Packit Service |
82fcde |
(void) WRITE2(": TLOSS error\n", 14);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 35:
|
|
Packit Service |
82fcde |
case 135:
|
|
Packit Service |
82fcde |
case 235:
|
|
Packit Service |
82fcde |
/* y0(x>X_TLOSS) */
|
|
Packit Service |
82fcde |
exc.type = TLOSS;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("y0");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2(exc.name, 2);
|
|
Packit Service |
82fcde |
(void) WRITE2(": TLOSS error\n", 14);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 36:
|
|
Packit Service |
82fcde |
case 136:
|
|
Packit Service |
82fcde |
case 236:
|
|
Packit Service |
82fcde |
/* j1(|x|>X_TLOSS) */
|
|
Packit Service |
82fcde |
exc.type = TLOSS;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("j1");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2(exc.name, 2);
|
|
Packit Service |
82fcde |
(void) WRITE2(": TLOSS error\n", 14);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 37:
|
|
Packit Service |
82fcde |
case 137:
|
|
Packit Service |
82fcde |
case 237:
|
|
Packit Service |
82fcde |
/* y1(x>X_TLOSS) */
|
|
Packit Service |
82fcde |
exc.type = TLOSS;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("y1");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2(exc.name, 2);
|
|
Packit Service |
82fcde |
(void) WRITE2(": TLOSS error\n", 14);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 38:
|
|
Packit Service |
82fcde |
case 138:
|
|
Packit Service |
82fcde |
case 238:
|
|
Packit Service |
82fcde |
/* jn(|x|>X_TLOSS) */
|
|
Packit Service |
82fcde |
exc.type = TLOSS;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("jn");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2(exc.name, 2);
|
|
Packit Service |
82fcde |
(void) WRITE2(": TLOSS error\n", 14);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 39:
|
|
Packit Service |
82fcde |
case 139:
|
|
Packit Service |
82fcde |
case 239:
|
|
Packit Service |
82fcde |
/* yn(x>X_TLOSS) */
|
|
Packit Service |
82fcde |
exc.type = TLOSS;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("yn");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2(exc.name, 2);
|
|
Packit Service |
82fcde |
(void) WRITE2(": TLOSS error\n", 14);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 40:
|
|
Packit Service |
82fcde |
case 140:
|
|
Packit Service |
82fcde |
case 240:
|
|
Packit Service |
82fcde |
/* tgamma(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("tgamma");
|
|
Packit Service |
82fcde |
exc.retval = __copysign (HUGE_VAL, x);
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 41:
|
|
Packit Service |
82fcde |
case 141:
|
|
Packit Service |
82fcde |
case 241:
|
|
Packit Service |
82fcde |
/* tgamma(-integer) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("tgamma");
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_) {
|
|
Packit Service |
82fcde |
(void) WRITE2("tgamma: SING error\n", 18);
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
case 44:
|
|
Packit Service |
82fcde |
case 144:
|
|
Packit Service |
82fcde |
case 244:
|
|
Packit Service |
82fcde |
/* exp(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("exp2");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 45:
|
|
Packit Service |
82fcde |
case 145:
|
|
Packit Service |
82fcde |
case 245:
|
|
Packit Service |
82fcde |
/* exp(finite) underflow */
|
|
Packit Service |
82fcde |
exc.type = UNDERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("exp2");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
case 46:
|
|
Packit Service |
82fcde |
case 146:
|
|
Packit Service |
82fcde |
case 246:
|
|
Packit Service |
82fcde |
/* exp(finite) overflow */
|
|
Packit Service |
82fcde |
exc.type = OVERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("exp10");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 47:
|
|
Packit Service |
82fcde |
case 147:
|
|
Packit Service |
82fcde |
case 247:
|
|
Packit Service |
82fcde |
/* exp(finite) underflow */
|
|
Packit Service |
82fcde |
exc.type = UNDERFLOW;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("exp10");
|
|
Packit Service |
82fcde |
exc.retval = zero;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 48:
|
|
Packit Service |
82fcde |
case 148:
|
|
Packit Service |
82fcde |
case 248:
|
|
Packit Service |
82fcde |
/* log2(0) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("log2");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = -HUGE_VAL;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 49:
|
|
Packit Service |
82fcde |
case 149:
|
|
Packit Service |
82fcde |
case 249:
|
|
Packit Service |
82fcde |
/* log2(x<0) */
|
|
Packit Service |
82fcde |
exc.type = DOMAIN;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("log2");
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
exc.retval = -HUGE;
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
exc.retval = NAN;
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
__set_errno (EDOM);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
case 50:
|
|
Packit Service |
82fcde |
case 150:
|
|
Packit Service |
82fcde |
case 250:
|
|
Packit Service |
82fcde |
/* tgamma(+-0) */
|
|
Packit Service |
82fcde |
exc.type = SING;
|
|
Packit Service |
82fcde |
exc.name = CSTR ("tgamma");
|
|
Packit Service |
82fcde |
exc.retval = __copysign (HUGE_VAL, x);
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _POSIX_)
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
else if (!matherr(&exc)) {
|
|
Packit Service |
82fcde |
if (_LIB_VERSION == _SVID_)
|
|
Packit Service |
82fcde |
(void) WRITE2("tgamma: SING error\n", 18);
|
|
Packit Service |
82fcde |
__set_errno (ERANGE);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
break;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* #### Last used is 50/150/250 ### */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
default:
|
|
Packit Service |
82fcde |
__builtin_unreachable ();
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
return exc.retval;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
#endif
|