On Mon, Oct 5, 2009 at 1:45 AM, rjf <[email protected]> wrote:
>
> A much more interesting example is this (in Maxima)
>
> fpprec:16
> sin (bfloat(2)^10000)
>
> -6.104079172368958b-1
>
> which is correct to 16 decimal places.
>
> Making this work by adding in more terms in the taylor series for
> sine would be a very bad idea.
>
> Instead, the sine routine first compute pi to 10016 or more decimal
> places.
>
> I assume mpfr does such things. I hope you do such things in python
> numerics.
Yes, you don't need to worry about it :-)
In SymPy:
>>> from sympy import sin, Real
>>> sin(Real(2)**10000).evalf(16)
-0.6104079172368958
In mpmath:
>>> from mpmath import sin, mpf
>>> sin(mpf(2)**10000, dps=16)
mpf('-0.6104079172368958')
Fredrik
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---