On 5/9/07, Robert Miller <[EMAIL PROTECTED]> wrote:
>
> I know this isn't a bug in sage, but it is good to be aware of... If
> the contents of the file crash.py is:
>
> <file>
> def crash():
>     n = 5
>     k = 2
>     return [( 2**(n-2*i-2) - 2**(floor(n/2)-i-1) - 1 ) for i in
> range(k)]
> </file>
>
> Then you get bizarre behavior:
>
> sage: load crash.py
> sage: crash()
>
> ------------------------------------------------------------
> Unhandled SIGSEGV: A segmentation fault occured in SAGE.
> <etc>
> ------------------------------------------------------------
>
> So far my ignorance has prevented me from reproducing this in Python
> alone (I'm too dependent on the sage environment).

Thanks for the bug report!

Actually, it's a bug in SAGE-2.5 not Python.  It comes
from the floor function, which you're implicitly calling,
and which is not the same as the Python floor function.
In fact, it's a new symbolic function, so cool things like this
make sense:

sage: f = floor(x^2 + 1)
sage: f
floor(x^2) + 1
sage: f(x=5)
26
sage: f(x=3/2)
3
sage: show(plot(f))

It calls the floor method on objects if they have them, but
didn't correctly deal with the builtin Python numeric types,
which don't have a floor method.  This led to a problem.

Apply the attached patch to fix it, or do hg_sage.pull(), which
will also give you a fix to dsage.

William

--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Attachment: 4393.patch
Description: Binary data

Reply via email to