Hi,
Here are 2 examples in ZZ that don't work nicely when the range is
invalid in random_element():
{{{
sage: ZZ.random_element(9,-9) # not a valid range
11
sage: ZZ.random_element(9,9) # single element, crashes SAGE
------------------------------------------------------------
Unhandled SIGFPE: An unhandled floating point exception occured in
SAGE.
This probably occured because a *compiled* component
of SAGE has a bug in it (typically accessing invalid memory)
[...]
}}}
I modified ZZ's random_element() method so that it raises a ValueError
when situations like the above occur.
I also gave RR its own random_element() method (it looks like it was
relyin on a generic one). It now that it mimics RDF.random_element():
{{{
sage: RDF.random_element(20)
5.648453007
sage: RR.random_element(20)
15.3961818555746
sage: RDF.random_element(20,30)
24.0967819625
sage: RR.random_element(20,30)
25.3797634155821
}}}
Here is the complete patch:
http://sage.math.washington.edu/home/dfdeshom/custom/patches/random_element-improv.txt
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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/
-~----------~----~----~----~------~----~------~--~---