[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2018-07-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: After fixing platform.libc_ver() in issue26544 we can use it for conditional skipping this assertion depending on the libc version. -- versions: +Python 3.8 ___ Python tracker

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-20 Thread Tim Peters
Tim Peters added the comment: I have no opinion about any version of xxxBSD, because I've never used one ;-) If current versions of those do have this failure, has anyone opened a bug report on _their_ tracker(s)? I've seen no reason yet to imagine these failures are a

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Do you consider the recent stable releases of OpenBSD 6.1 (April 11, 2017) and NetBSD 7.1 (March 11, 2017) out-of-date platforms? The develop version of NetBSD 8 has the same failure. --

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-19 Thread Tim Peters
Tim Peters added the comment: Best I can tell, the fdlibm 5.3 on netlib was released in 2002, and essentially stopped existing as a maintained project then. Everyone else copied the source code, and made their own changes independently ever since :-( At least the folks

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-18 Thread Stefan Krah
Stefan Krah added the comment: I found an unused i386 box with OpenBSD and Linux (so no VM): A C program with tan(1.5707963267948961) is wrong on both systems. fdlibm (directly from netlib.org) is correct on both systems. Both OS versions are relatively old, so I cannot

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-18 Thread Stefan Krah
Stefan Krah added the comment: Tim has mentioned the high quality of fdlibm, and indeed I cannot reproduce the issue: wget -r http://www.netlib.org/fdlibm/ Then build libm with or without optimizations, with or without -m32, gcc or clang. Then compile a C program

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-02 Thread Mark Dickinson
Mark Dickinson added the comment: > I'd be surprised if sin(x)/cos(x) were materially better. Yep. I made the same assumption as you, but then "realised" that to get to the tan tests, we must already have passed all the cos tests, so cos must be okay. I thought I'd

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-01 Thread Tim Peters
Tim Peters added the comment: Oops! I mixed up `sin` and `cos` in that comment. If it's argument reduction that's broken, then for x near pi/2 cos(x) will be evaluated as -sin(x - pi/2), which is approximately -(x - pi/2), and so error in argument reduction (the "x - pi/2"

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-01 Thread Tim Peters
Tim Peters added the comment: Since fdlibm uses tan(x) ~= -1/(x-pi/2) in this range, and the reciprocals of the bad results have a whole of bunch of trailing zero bits, my guess is that argument reduction (the "x-pi/2" part) is screwing up (losing bits of pi/2 beyond the

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-01 Thread Stefan Krah
Stefan Krah added the comment: On Wed, Nov 01, 2017 at 06:17:44PM +, Mark Dickinson wrote: > I'm really reluctant to (even conditionally) skip the test, because it's > doing exactly what it's designed to do, namely detecting and reporting that > Python is giving poor

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-11-01 Thread Mark Dickinson
Mark Dickinson added the comment: The big mystery for me is not "Why this is occurring in the first place?" but "What should we do about it?" I'm really reluctant to (even conditionally) skip the test, because it's doing exactly what it's designed to do, namely detecting

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Stefan Krah
Stefan Krah added the comment: On Tue, Oct 31, 2017 at 07:32:00PM +, Serhiy Storchaka wrote: > >>From 4 considered results the tests are failed on gcc 4.2.1, 4.7.2, 4.8.5, > >>but are passes on gcc 7.2.0. I suppose this is gcc or libc bug fixed in > >>recent versions.

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >From 4 considered results the tests are failed on gcc 4.2.1, 4.7.2, 4.8.5, but >are passes on gcc 7.2.0. I suppose this is gcc or libc bug fixed in recent >versions. -- ___ Python

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Stefan Krah
Stefan Krah added the comment: So the big mystery is still: https://mail.python.org/pipermail/python-dev/2017-October/149880.html Could be a Linux router with some alternative libc ... -- ___ Python tracker

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Mark Dickinson
Mark Dickinson added the comment: > Seems the first result is calculated at compile time Makes sense. Last time I looked, gcc uses MPFR for the compile-time calls, so I'd expect those to be correctly rounded. -- ___ Python

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I have got both (!) results in the same binary on NetBSD (gcc 4.8.5). tan(1.57079632679489611) = 1978937966095219.00 tan(0x1.921fb54442d16p+0) = 0x1.c1f559a01adccp+50 tan(1.57079632679489611) = 1978945885716843.00

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-29 Thread Stefan Krah
Stefan Krah added the comment: Also, does this occur in a VM on on the bare metal or both? What leaves me puzzled is that I cannot reproduce the Linux x86 report with almost the exact same compiler. But I'm on x64 and use -m32. --

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-29 Thread Tim Peters
Tim Peters added the comment: BTW, has anyone tried running a tiny C program on these platforms to see what tan(1.5707963267948961) delivers? The kind of code fdlibm uses is sensitive not only to compiler (mis)optimization, but also to stuff like how the FPU's "precision

[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-29 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Tests -Extension Modules title: math.tan has poor accuracy near pi/2 on OpenBSD -> math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD versions: +Python 2.7, Python 3.6, Python 3.7