NetBSD Problem Report #51427

From wiz@yt.nih.at  Fri Aug 19 18:04:48 2016
Return-Path: <wiz@yt.nih.at>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 33BD97A218
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 19 Aug 2016 18:04:48 +0000 (UTC)
Message-Id: <20160819165812.9AA502AC0C5@yt.nih.at>
Date: Fri, 19 Aug 2016 18:58:12 +0200 (CEST)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: libm issues triggered by py-numpy
X-Send-Pr-Version: 3.95

>Number:         51427
>Category:       lib
>Synopsis:       libm issues triggered by py-numpy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 19 18:05:00 +0000 2016
>Closed-Date:    
>Last-Modified:  Mon May 08 01:48:49 +0000 2017
>Originator:     Thomas Klausner
>Release:        NetBSD 7.99.35
>Organization:
Curiosity is the very basis of education and if you tell me that 
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
>Environment:


Architecture: x86_64
Machine: amd64
>Description:
When running the py-numpy tests (current version as of writing this PR 1.11.1)
on NetBSD there are 19 problems, 18 of which upstream claims are libm problems.
>How-To-Repeat:
cd /usr/pkgsrc/math/py-numpy
make test

gives:

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'sqrt'>, -0.5, 1j, 1, -1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1889, in _check_branch_cut
    assert_(np.all(np.absolute(y0[ji].imag - ym.imag*im_sign) < atol), (y0[ji], ym))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 0.+0.70710678j]), array([ 0.+0.70710678j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arcsin'>, [-2, 2], [1j, 1j], 1, -1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1869, in _check_branch_cut
    assert_(np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([-1.57079633+1.3169579j,  1.57079633-1.3169579j]), array([-1.57079633+1.3169579j,  1.57079633+1.3169579j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arccos'>, [-2, 2], [1j, 1j], 1, -1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1869, in _check_branch_cut
    assert_(np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 3.14159265-1.3169579j,  0.00000000+1.3169579j]), array([  3.14159265e+00-1.3169579j,   2.56239474e-13-1.3169579j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arctan'>, [-2j, 2j], [1, 1], -1, 1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1868, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ -1.57079633e+000 -5.49306144e-001j,
         1.79769313e+308 +1.79769313e+308j]), array([ 1.57079633-0.54930614j,  1.57079633+0.54930614j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arcsinh'>, [-2j, 2j], [1, 1], -1, 1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1868, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([-1.3169579-1.57079633j,  1.3169579+1.57079633j]), array([ 1.3169579-1.57079633j,  1.3169579+1.57079633j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arccosh'>, [-1, 0.5], [1j, 1j], 1, -1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1889, in _check_branch_cut
    assert_(np.all(np.absolute(y0[ji].imag - ym.imag*im_sign) < atol), (y0[ji], ym))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([  0.00000000e+00+3.14159265j,  -1.11022302e-16+1.04719755j]), array([  0.00000000e+00+3.14159265j,  -1.11022302e-16+1.04719755j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arctanh'>, [-2, 2], [1j, 1j], 1, -1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1868, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ -5.49306144e-001 -1.57079633e+000j,
         1.79769313e+308 -1.79769313e+308j]), array([-0.54930614+1.57079633j,  0.54930614+1.57079633j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'sqrt'>, -0.5, 1j, 1, -1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1889, in _check_branch_cut
    assert_(np.all(np.absolute(y0[ji].imag - ym.imag*im_sign) < atol), (y0[ji], ym))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 0.+0.70710677j], dtype=complex64), array([ 0.+0.70710677j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arcsin'>, [-2, 2], [1j, 1j], 1, -1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1869, in _check_branch_cut
    assert_(np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([-1.57079637+1.31695783j,  1.57079637-1.31695795j], dtype=complex64), array([-1.57078254+1.31695783j,  1.57078254+1.31695783j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arccos'>, [-2, 2], [1j, 1j], 1, -1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1869, in _check_branch_cut
    assert_(np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 3.14159274-1.31695783j,  0.00000000+1.31695795j], dtype=complex64), array([  3.14157891e+00-1.31695783j,   1.38282776e-05-1.31695783j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arctan'>, [-2j, 2j], [1, 1], -1, 1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1868, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ -1.57079625e+00 -5.49306154e-01j,   3.40282347e+38 +3.40282347e+38j], dtype=complex64), array([ 1.57078838-0.54930615j,  1.57078838+0.54930615j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arcsinh'>, [-2j, 2j], [1, 1], -1, 1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1868, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([-1.31695795-1.57079637j,  1.31695783+1.57079637j], dtype=complex64), array([ 1.31695783-1.57078254j,  1.31695783+1.57078254j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arccosh'>, [-1, 0.5], [1j, 1j], 1, -1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1889, in _check_branch_cut
    assert_(np.all(np.absolute(y0[ji].imag - ym.imag*im_sign) < atol), (y0[ji], ym))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 0.+3.14159274j,  0.+1.04719758j], dtype=complex64), array([ 0.+3.14159274j,  0.+1.04719758j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arctanh'>, [-2, 2], [1j, 1j], 1, -1, True, <class 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1868, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ -5.49306154e-01 -1.57079625e+00j,   3.40282347e+38 -3.40282347e+38j], dtype=complex64), array([-0.54930615+1.57078838j,  0.54930615+1.57078838j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_loss_of_precision(<class 'numpy.complex64'>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1755, in check_loss_of_precision
    check(x_series, 2.1*eps)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1726, in check
    'arcsinh'))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (0, 9.9999997e-21, inf, 'arcsinh')

======================================================================
FAIL: test_umath.TestComplexFunctions.test_loss_of_precision(<class 'numpy.complex128'>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1755, in check_loss_of_precision
    check(x_series, 2.1*eps)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 1726, in check
    'arcsinh'))
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: (0, 1.0000000000000001e-20, inf, 'arcsinh')

======================================================================
FAIL: test_ldexp_overflow (test_umath.TestLdexp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/core/tests/test_umath.py", line 750, in test_ldexp_overflow
    assert_equal(ncu.ldexp(2., imax), np.inf)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 367, in assert_equal
    raise AssertionError(msg)
AssertionError:
Items are not equal:
 ACTUAL: 0.0
 DESIRED: inf

======================================================================
FAIL: test_scripts.test_f2py
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/decorators.py", line 147, in skipper_func
    return f(*args, **kwargs)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/tests/test_scripts.py", line 99, in test_f2py
    assert_(success, msg)
  File "/scratch/math/py-numpy/work/.destdir/usr/pkg/lib/python3.5/site-packages/numpy/testing/utils.py", line 75, in assert_
    raise AssertionError(smsg)
AssertionError: Warning: neither f2py nor f2py3 nor f2py3.5 found in path

----------------------------------------------------------------------
Ran 6125 tests in 112.629s

FAILED (KNOWNFAIL=8, SKIP=9, errors=1, failures=18)

The last one is not libm related, the others are according to upstream, see
https://github.com/numpy/numpy/issues/7948

>Fix:
Please!

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Sun, 21 Aug 2016 10:12:57 +0200

 Since we'll need them anyway and to help fixing/testing: someone please
 add these cases to our existing libm tests, it is very trivial once you
 understand what the python code is trying to do.

 The atf tests are in src/tests/lib/libm and usually very easy to read
 and extend.

 Martin

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Mon, 22 Aug 2016 04:59:28 +0000

 possibly related:

 $ cat test.c
 #include <math.h>
 #include <stdio.h>
 void main() {
   printf("%d\n", ilogb(INFINITY));
 }
 $ cc -lm test.c && ./a.out
 -2147483648

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Mon, 22 Aug 2016 06:01:40 +0000

 --k1lZvvs/B4yU6o8G
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 How about this test?
 (I am unsure about -INFINITE)

 --k1lZvvs/B4yU6o8G
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=ilogb-test

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libm/Makefile,v
 retrieving revision 1.37
 diff -u -r1.37 Makefile
 --- Makefile	24 Jan 2016 20:26:47 -0000	1.37
 +++ Makefile	22 Aug 2016 06:00:03 -0000
 @@ -23,6 +23,7 @@
  TESTS_C+=	t_fenv
  TESTS_C+=	t_fmod
  TESTS_C+=	t_hypot
 +TESTS_C+=	t_ilogb
  TESTS_C+=	t_infinity
  TESTS_C+=	t_ldexp
  TESTS_C+=	t_log
 Index: t_ilogb.c
 ===================================================================
 RCS file: t_ilogb.c
 diff -N t_ilogb.c
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ t_ilogb.c	22 Aug 2016 06:00:03 -0000
 @@ -0,0 +1,71 @@
 +/* $NetBSD$ */
 +
 +/*-
 + * Copyright (c) 2016 The NetBSD Foundation, Inc.
 + * All rights reserved.
 + *
 + * This code is derived from software contributed to The NetBSD Foundation
 + * by Maya Rashish.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 + * POSSIBILITY OF SUCH DAMAGE.
 + */
 +
 +#include <atf-c.h>
 +#include <float.h>
 +#include <math.h>
 +
 +ATF_TC(ilogb);
 +ATF_TC_HEAD(ilogb, tc)
 +{
 +	atf_tc_set_md_var(tc, "descr","Check ilogb family");
 +}
 +
 +ATF_TC_BODY(ilogb, tc)
 +{
 +  atf_tc_expect_fail("PR lib/51427");
 +
 +	ATF_CHECK(ilogbf(0) == FP_ILOGB0);
 +	ATF_CHECK(ilogb(0) == FP_ILOGB0);
 +	ATF_CHECK(ilogbl(0) == FP_ILOGB0);
 +
 +	ATF_CHECK(ilogbf(INFINITY) == INT_MAX);
 +	ATF_CHECK(ilogb(INFINITY) == INT_MAX);
 +	ATF_CHECK(ilogbl(INFINITY) == INT_MAX);
 +
 +	ATF_CHECK(ilogbf(-INFINITY) == INT_MAX);
 +	ATF_CHECK(ilogb(-INFINITY) == INT_MAX);
 +	ATF_CHECK(ilogbl(-INFINITY) == INT_MAX);
 +
 +#ifndef __vax__
 +	ATF_CHECK(ilogbf(NAN) == FP_ILOGBNAN);
 +	ATF_CHECK(ilogb(NAN) == FP_ILOGBNAN);
 +	ATF_CHECK(ilogbl(NAN) == FP_ILOGBNAN);
 +#endif
 +}
 +
 +ATF_TP_ADD_TCS(tp)
 +{
 +
 +	ATF_TP_ADD_TC(tp, ilogb);
 +
 +	return atf_no_error();
 +}

 --k1lZvvs/B4yU6o8G--

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51427 CVS commit: src
Date: Mon, 22 Aug 2016 08:49:33 +0000

 Module Name:	src
 Committed By:	maya
 Date:		Mon Aug 22 08:49:33 UTC 2016

 Modified Files:
 	src/distrib/sets/lists/debug: mi
 	src/distrib/sets/lists/tests: mi
 	src/tests/lib/libm: Makefile
 Added Files:
 	src/tests/lib/libm: t_ilogb.c

 Log Message:
 add failing test for PR lib/51427
 ilogb(INFINITY)=-INT_MAX, it should be INT_MAX

 while here, test raised exceptions, other values.

 XXX some platforms don't have exceptions


 To generate a diff of this commit:
 cvs rdiff -u -r1.164 -r1.165 src/distrib/sets/lists/debug/mi
 cvs rdiff -u -r1.683 -r1.684 src/distrib/sets/lists/tests/mi
 cvs rdiff -u -r1.37 -r1.38 src/tests/lib/libm/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_ilogb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Tue, 30 Aug 2016 11:59:18 +0000

 I wanted to create a test for casinh (complex arcsinh), as it's
 mentioned as one of the failures, but I'm having some trouble because I
 don't know how to define values for the edge cases.

 for example, creal(0+I*INFINITY) = NAN. I expected 0.

 I based my examples on http://en.cppreference.com/w/c/numeric/complex/casinh
 and wrote the code here (link to avoid noise): http://coypu.sdf.org/t_casinh.c

 suggestions?

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Tue, 30 Aug 2016 14:43:36 +0000

 uwe suggested:
   #define RE(z) (((double *)(&z))[0])
   #define IM(z) (((double *)(&z))[1])

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, Thomas Klausner <wiz@NetBSD.org>
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Tue, 30 Aug 2016 23:59:15 +0200

 On Tue, Aug 30, 2016 at 12:00:02PM +0000, coypu@SDF.ORG wrote:
 >  for example, creal(0+I*INFINITY) = NAN. I expected 0.

 The problem here is not so much creal(), but the construction of the
 complex number itself. For C11, we should support CMPLX and friends that
 directly take real and imaginary part as argument, but for C99 and
 before you have to construct them separately via the __real__ and
 __imag__ builtins, I think.

 Joerg

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Tue, 11 Oct 2016 14:53:46 +0000

 We are down to this:

 ======================================================================
 FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'sqrt'>, -0.5, 1j, 1, -1, True)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/pkg/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
     self.test(*self.arg)
   File "/usr/pkgsrc/math/py-numpy/work/.destdir/usr/pkg/lib/python2.7/site-packages/numpy/core/tests/test_umath.py", line 1889, in _check_branch_cut
     assert_(np.all(np.absolute(y0[ji].imag - ym.imag*im_sign) < atol), (y0[ji], ym))
   File "/usr/pkgsrc/math/py-numpy/work/.destdir/usr/pkg/lib/python2.7/site-packages/numpy/testing/utils.py", line 75, in assert_
     raise AssertionError(smsg)
 AssertionError: (array([ 0.+0.70710678j]), array([ 0.+0.70710678j]))

 ======================================================================
 FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'sqrt'>, -0.5, 1j, 1, -1, True, <type 'numpy.complex64'>)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/pkg/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
     self.test(*self.arg)
   File "/usr/pkgsrc/math/py-numpy/work/.destdir/usr/pkg/lib/python2.7/site-packages/numpy/core/tests/test_umath.py", line 1889, in _check_branch_cut
     assert_(np.all(np.absolute(y0[ji].imag - ym.imag*im_sign) < atol), (y0[ji], ym))
   File "/usr/pkgsrc/math/py-numpy/work/.destdir/usr/pkg/lib/python2.7/site-packages/numpy/testing/utils.py", line 75, in assert_
     raise AssertionError(smsg)
 AssertionError: (array([ 0.+0.70710677j], dtype=complex64), array([ 0.+0.70710677j], dtype=complex64))

 ----------------------------------------------------------------------
 Ran 6115 tests in 59.866s

 FAILED (KNOWNFAIL=7, SKIP=8, errors=1, failures=2)


 Thanks christos

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51427: libm issues triggered by py-numpy
Date: Tue, 11 Oct 2016 15:08:45 +0000

 >  ----------------------------------------------------------------------
 >  Ran 6115 tests in 59.866s

 I hope it's not because they removed tests, though!

 secondary: now `nm /lib/libm.so | grep casinl` doesn't give results.
 not sure if that was the case before.

Responsible-Changed-From-To: lib-bug-people->maya
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Sat, 31 Dec 2016 20:02:29 +0000
Responsible-Changed-Why:
celebratory take.


State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 31 Dec 2016 20:02:29 +0000
State-Changed-Why:
celebratory feedback requested.


From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51427 CVS commit: src/lib/libm/complex
Date: Sat, 31 Dec 2016 20:01:15 +0000

 Module Name:	src
 Committed By:	maya
 Date:		Sat Dec 31 20:01:15 UTC 2016

 Modified Files:
 	src/lib/libm/complex: csqrt.c csqrtf.c

 Log Message:
 csqrt has a branch cut on the negative real axis, and this requires
 delicacy in order to maintain continuity around it.

 we have an initial case to deal with a fairly common case: getting
 a real number. Avoid dealing with the branch cut in this case by
 checking if the real part is negative.

 later, -0.0 < 0 is not met, so instead, test for a negative number
 using signbit, so negative zero is also treated as a negative number.

 Fixes last part of PR lib/51427: libm issues triggered by py-numpy

 ok riastradh


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/lib/libm/complex/csqrt.c
 cvs rdiff -u -r1.1 -r1.2 src/lib/libm/complex/csqrtf.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 05 Jan 2017 08:14:12 +0000
State-Changed-Why:
I just tested py-numpy with python-3.6 on -current, and there is only the f2py failure
left.

Thank you very much!


Responsible-Changed-From-To: maya->lib-bug-people
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Mon, 08 May 2017 01:48:49 +0000
Responsible-Changed-Why:
Unassign for now


State-Changed-From-To: closed->open
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 08 May 2017 01:48:49 +0000
State-Changed-Why:
Re-open because christos restored some of the old buggy code.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.