Thanks Didier -- all excellent choices. -- William
On 2/13/07, didier deshommes <[EMAIL PROTECTED]> wrote: > > > 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 > > > > > -- William Stein Associate Professor of Mathematics University of Washington --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---