[Numpy-discussion] what goes wrong with cos(), sin()
Wed Feb 21 16:09:39 CST 2007
On 21/02/07, Robert Kern <email@example.com> wrote:
> Well, you can always use long double if it is implemented on your platform. You
> will have to construct a value for π yourself, though. I'm afraid that we don't
> really make that easy.
If the trig functions are implemented at all, you can probably use
atan2(-1,0) and get a decent approximation; alternatively, if you want
to use sin(pi)=0 as a definition you could use scipy's bisection
routine (which is datatype-independent, IIRC) to find pi. Or you could
probably use a rational approximation to pi, then convert numerator
and denominator to long doubles, or better yet compare the rational
number with your long double approximation of pi.
But no, not particularly easy.
More information about the Numpy-discussion