This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients Rhamphoryncus, christian.heimes, gmcastil, mark.dickinson, tim.peters
Date 2008-01-22.01:41:59
SpamBayes Score 5.5119555e-05
Marked as misclassified No
Message-id <479549E4.9060900@cheimes.de>
In-reply-to <1200948135.63.0.0562083307068.issue1640@psf.upfronthosting.co.za>
Content
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;
History
Date User Action Args
2008-01-22 01:42:01christian.heimessetspambayes_score: 5.51196e-05 -> 5.5119555e-05
recipients: + christian.heimes, tim.peters, mark.dickinson, Rhamphoryncus, gmcastil
2008-01-22 01:41:59christian.heimeslinkissue1640 messages
2008-01-22 01:41:59christian.heimescreate