[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD
Tim Peters
report at bugs.python.org
Sun Oct 1 15:02:35 EDT 2017
Tim Peters <tim at python.org> added the comment:
Of course the relationship is extremely delicate near pi/2. On my Windows Python 3:
>>> import math
>>> (1.5707963267948961).hex()
'0x1.921fb54442d16p+0'
>>> math.tan(float.fromhex('0x1.921fb54442d16p+0')) # what the test expects
1978937966095219.0
>>> math.tan(float.fromhex('0x1.921fb54442d15p+0')) # input 1 ulp less
1374823386397210.2
>>> math.tan(float.fromhex('0x1.921fb54442d17p+0')) # input 1 ulp more
3530114321217157.5
Interestingly, wxMaxima on the same box reproduces the OpenBSD result:
(%i1) tan(1.5707963267948961);
(%o1) 1.978945885716843*10^15
But I don't know how Maxima (or OpenBSD) implement tan().
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31630>
_______________________________________
More information about the Python-bugs-list
mailing list