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

Raymond Hettinger report at bugs.python.org
Sun Oct 1 13:53:44 EDT 2017


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

I would have thought this would be a straight pass-through to the underlying hardware FPU tan() instruction so that it would give the same answer for the same hardware regardless of O/S.

Perhaps we're seeing a software-only implementation (using CORDIC or somesuch).  If so, inputs close to a singularity are the place where the implementation is likely to fall apart (the relative error in this example is 1.000004001955473).

* https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
* https://stackoverflow.com/questions/16880376/sin-cos-tan-not-accurate
* http://code.activestate.com/recipes/576792-polar-to-rectangular-conversions-using-cordic/

----------
nosy: +rhettinger, tim.peters

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31630>
_______________________________________


More information about the Python-bugs-list mailing list