Christian Heimes added the comment: Mark Dickinson wrote: > - it doesn't touch errno, but lets the platform decide how to handle errors > (i.e. produce a > special value/set errno/signal a floating-point exception/some combination of > these). This will > make the asinh, acosh, atanh functions behave in the same way that the > regular libm functions > behave on any platform. So e.g. if a particular platform is used to setting > errno for domain > errors like sqrt(-1), it'll do so for atanh/asinh/acosh. And another > platform that signals a > floating-point exception for sqrt(-1) will do the same for atanh(3).
I tried your patch. It fixes the problem with atanh0022 and 0023 test but it breaks in other places. math.acosh(0) returns NaN and does NOT raise an exception. math.atanh(1) raises OverflowError instead of ValueError. The libm of uclibc *does* set errno for signaling NaN. The relevant code is in w_acos.c and k_standard.c. I don't know how emit a signal for a NaN but setting errno sounds reasonable for me and it gives the desired output. w_acosh.c: double acosh(double x) /* wrapper acosh */ { #ifdef _IEEE_LIBM return __ieee754_acosh(x); #else double z; z = __ieee754_acosh(x); if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; if(x<1.0) { return __kernel_standard(x,x,29); /* acosh(x<1) */ } else return z; #endif } kernel_standard: case 129: /* acosh(x<1) */ exc.type = DOMAIN; exc.name = type < 100 ? "acosh" : "acoshf"; exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("acosh: DOMAIN error\n", 20); } errno = EDOM; } break; __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1640> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com