diff options
Diffstat (limited to 'newlib/libm/math/w_gamma.c')
-rw-r--r-- | newlib/libm/math/w_gamma.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/newlib/libm/math/w_gamma.c b/newlib/libm/math/w_gamma.c index a1f50b593..6de114a86 100644 --- a/newlib/libm/math/w_gamma.c +++ b/newlib/libm/math/w_gamma.c @@ -121,14 +121,12 @@ When <[x]> is a nonpositive integer, <<gamma>> returns <<HUGE_VAL>> and <<errno>> is set to <<EDOM>>. If the result overflows, <<gamma>> returns <<HUGE_VAL>> and <<errno>> is set to <<ERANGE>>. -You can modify this error treatment using <<matherr>>. - PORTABILITY Neither <<gamma>> nor <<gammaf>> is ANSI C. It is better not to use either of these; use <<lgamma>> or <<tgamma>> instead.@* <<lgamma>>, <<lgammaf>>, <<tgamma>>, and <<tgammaf>> are nominally C standard -in terms of the base return values, although the <<matherr>> error-handling -is not standard, nor is the <[signgam]> global for <<lgamma>>. +in terms of the base return values, although the <[signgam]> global for +<<lgamma>> is not standard. */ /* double gamma(double x) @@ -154,7 +152,6 @@ is not standard, nor is the <[signgam]> global for <<lgamma>>. return __ieee754_gamma_r(x,&(_REENT_SIGNGAM(_REENT))); #else double y; - struct exception exc; y = __ieee754_gamma_r(x,&(_REENT_SIGNGAM(_REENT))); if(_LIB_VERSION == _IEEE_) return y; if(!finite(y)&&finite(x)) { @@ -164,33 +161,14 @@ is not standard, nor is the <[signgam]> global for <<lgamma>>. SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */ #endif - exc.name = "gamma"; - exc.err = 0; - exc.arg1 = exc.arg2 = x; - if (_LIB_VERSION == _SVID_) - exc.retval = HUGE; - else - exc.retval = HUGE_VAL; if(floor(x)==x&&x<=0.0) { /* gamma(-integer) or gamma(0) */ - exc.type = SING; - if (_LIB_VERSION == _POSIX_) - errno = EDOM; - else if (!matherr(&exc)) { - errno = EDOM; - } - } else { + errno = EDOM; + } else { /* gamma(finite) overflow */ - exc.type = OVERFLOW; - if (_LIB_VERSION == _POSIX_) - errno = ERANGE; - else if (!matherr(&exc)) { - errno = ERANGE; - } - } - if (exc.err != 0) - errno = exc.err; - return exc.retval; + errno = ERANGE; + } + return HUGE_VAL; } else return y; #endif |