On Mar 28, 2007, at 10:27 , cwitty wrote:
> On Mar 28, 12:53 am, Robert Bradshaw <[EMAIL PROTECTED]>
> wrote:
>> Thank you. This is exactly the kind of information I was looking for.
>> I knew about the range of values limitation, but was only vaguely
>> aware of the rest. The situation I'm thinking of is the default
>> implicit ring (e.g. when one enters "3.2") in which case the lack of
>> support for rounding modes wouldn't probably be a big issue (if one
>> cares about such things, one would probably want to specify it
>> explicitly). The lack of precision/portability/consistency could be a
>> major issue though. Of course all options would be available
>> explicitly, but do you think this last point is severe enough to
>> write off using them as the default implicit ring despite their
>> relative inefficiency? Perhaps one could claim that they only really
>> have 51 bits of precision (or are the answers sometimes way off,
>> other than inf/nan)?
> In the following carefully chosen example, we see a case where a
> native double result (or a result using RDF) has only 4 correct digits
> (about 12 bits).  (This example is from John Harrison's paper, _Formal
> verification of floating point trigonometric functions_.)
>
> sage: n = RR('13126962.690651042')
> sage: n == RR(float(n))
> True
> sage: sin(n)
> -0.000000000452018866841080
> sage: math.sin(float(n))
> -4.5200196699662215e-10
> sage: tan(n)
> -0.000000000452018866841080
> sage: tan(RDF(n))
> -4.52001966997e-10
>
> The trick is to find a floating-point number which is very close to a
> multiple of Pi; this means that the range reduction step needs to use
> a very precise approximation of Pi.  (This transcript is from a Linux
> (Debian testing) box with an Intel Core 2 Duo processor in 32-bit
> mode; I would be curious if other architectures/operating systems give
> different results.)

This comes from two 32-bit versions on Mac OS X:
G5 PowerPC:
sage: n = RR('13126962.690651042')
sage: n == RR(float(n))
True
sage: sin(n)
-0.000000000452018866841080
sage: math.sin(float(n))
-4.5201886684108046e-10
sage: tan(n)
-0.000000000452018866841080
sage: tan(RDF(n))
-4.52018866841e-10

Core Duo:
sage: n = RR('13126962.690651042')
sage: n == RR(float(n))
True
sage: sin(n)
-0.000000000452018866841080
sage: math.sin(float(n))
-4.5200196699662215e-10
sage: tan(n)
-0.000000000452018866841080
sage: tan(RDF(n))
-4.52001966997e-10

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
I'm beginning to like the cut of his jibberish.
-----------




--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to