Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

lib/51427: libm issues triggered by py-numpy

5 views
Skip to first unread message

Thomas Klausner

unread,
Aug 19, 2016, 2:05:18 PM8/19/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org
>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
>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!

>Unformatted:


Martin Husemann

unread,
Aug 21, 2016, 4:15:09 AM8/21/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: Martin Husemann <mar...@duskware.de>
To: gnats...@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

co...@sdf.org

unread,
Aug 22, 2016, 4:29:20 AM8/22/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: co...@SDF.ORG
To: gnats...@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


co...@sdf.org

unread,
Aug 22, 2016, 4:29:28 AM8/22/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: co...@SDF.ORG
To: gnats...@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--


co...@sdf.org

unread,
Aug 30, 2016, 8:00:11 AM8/30/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: co...@SDF.ORG
To: gnats...@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?

co...@sdf.org

unread,
Aug 30, 2016, 10:45:06 AM8/30/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: co...@SDF.ORG
To: gnats...@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])

Joerg Sonnenberger

unread,
Aug 30, 2016, 5:59:44 PM8/30/16
to gnats...@netbsd.org, lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
On Tue, Aug 30, 2016 at 12:00:02PM +0000, co...@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

Joerg Sonnenberger

unread,
Aug 30, 2016, 6:00:08 PM8/30/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: Joerg Sonnenberger <jo...@bec.de>
To: gnats...@NetBSD.org
Cc: lib-bug...@netbsd.org, gnats...@netbsd.org,
netbs...@netbsd.org, Thomas Klausner <w...@NetBSD.org>
Subject: Re: lib/51427: libm issues triggered by py-numpy

co...@sdf.org

unread,
Oct 11, 2016, 10:55:11 AM10/11/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
The following reply was made to PR lib/51427; it has been noted by GNATS.

From: co...@SDF.ORG
To: gnats...@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

co...@sdf.org

unread,
Oct 11, 2016, 11:10:07 AM10/11/16
to lib-bug...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Thomas Klausner
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.

0 new messages