NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/44057: tanh() function doesn't preserve the zero sign

>Number:         44057
>Category:       lib
>Synopsis:       tanh() function doesn't preserve the zero sign
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 07 14:30:00 +0000 2010
>Originator:     Victor Stinner
>Release:        5.0.x
"NetBSD 5.0.x i386", sorry I don't know more. It's a Python buildbot at:

Python test suite (test_math and test_cmath) fails on a test of the tanh() 
result sign for float and complex numbers. Python configure script has a test 
to check if tanh() preserves the sign or not: I just commited a patch to skip 
these tests if tanh() doesn't preserve the sign.

Python (closed) bug:

Extract of Python configure test:

# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
# -0. on some architectures.
AC_MSG_CHECKING(whether tanh preserves the sign of zero)
AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
#include <math.h>
#include <stdlib.h>
int main() {
    /* return 0 if either negative zeros don't exist
       on this platform or if negative zeros exist
       and tanh(-0.) == -0. */
  if (atan2(0., -1.) == atan2(-0., -1.) ||
      atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
  else exit(1);
if test "$ac_cv_tanh_preserves_zero_sign" = yes
  [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])

So it looks like FreeBSD 6.2 has the same bug.
Expected output:

$ python -c "import math; print(math.tanh(-0.0))"

Home | Main Index | Thread Index | Old Index