[sage-support] Re: Peculiar Arithmetic Results

2008-02-24 Thread Carl Witty

On Feb 24, 11:17 am, Carl Witty <[EMAIL PROTECTED]> wrote:
> Thanks for reporting this!  This is a bug when transferring floating-
> point values from Sage to interpreters such as gp and octave.  We are
> now tracking this bug here:http://trac.sagemath.org/sage_trac/ticket/2294;
> I expect to have a fix shortly.

A proposed fix is now posted at http://trac.sagemath.org/sage_trac/ticket/2294
.

Carl

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@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-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Peculiar Arithmetic Results

2008-02-24 Thread Carl Witty

On Feb 24, 10:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Support team:
>
> Here is a puzzle (to me if not to you).
>
> In sage 2.10.2 (although the problem occurs in earlier versions)
> on a CoreDuo MacIntosh running under MacOS X.5.2 we have:
>
> a = gp.sin(1)
> octave.eval('format long g')
> b = octave.sin(1)
> c = math.sin(1)
> eps = 1. - (4./3.-1.)*3.
> d = a*eps
> a
> 0.8414709848078965066525023216
> b
> 0.841470984807897
> c
> 0.8414709848078965
> (a-b)/d
> -2.640423314436302686
> (a-c)/d
> -553.9021661362176753
> (b-c)/d
> -553.7921192926074518167939202
>
> Notice that a, b, c all seem to agree to about 16 digits, but when
> the 'native' sage value is mixed with the gp and octave values a
> horrendously large error occurs.

Thanks for reporting this!  This is a bug when transferring floating-
point values from Sage to interpreters such as gp and octave.  We are
now tracking this bug here: http://trac.sagemath.org/sage_trac/ticket/2294;
I expect to have a fix shortly.

Carl

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@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-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Peculiar Arithmetic Results

2008-02-24 Thread Paul Zimmermann

   Hi David,

> Here is a puzzle (to me if not to you).
> 
> In sage 2.10.2 (although the problem occurs in earlier versions)
> on a CoreDuo MacIntosh running under MacOS X.5.2 we have:
> 
> 
> a = gp.sin(1)
> octave.eval('format long g')
> b = octave.sin(1)
> c = math.sin(1)
> eps = 1. - (4./3.-1.)*3.
> d = a*eps
> a
>   0.8414709848078965066525023216
> b
>   0.841470984807897
> c
>   0.8414709848078965
> (a-b)/d
>   -2.640423314436302686
> (a-c)/d
>   -553.9021661362176753
> (b-c)/d
>   -553.7921192926074518167939202
> 
> Notice that a, b, c all seem to agree to about 16 digits, but when
> the 'native' sage value is mixed with the gp and octave values a
> horrendously large error occurs.
> 
> The same behavior occurs for cos(1), exp(1), atan(1).
> 
> Something very peculiar is happening. What? Why?
> 
> Thank you,
> 
> David Galant

my guess is that in a-c, c is converted to 'sage.interfaces.gp.GpElement'
with a smaller precision:

sage: a-a.parent()(c)
-1.0349334749767836598 E-13
sage: a-c
-1.0349334749767836598 E-13

sage: c
0.8414709848078965
sage: a.parent()(c)
0.841470984808

Paul Zimmermann

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@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-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---