Thanks to needing some code for a numerical analysis class, I recently did a big cleanup of RR documentation (lots of doctests added!), and have some questions about corner cases. Hooray for having open source code so I can read it and look for issues :).

The ticket documenting these corner cases is http://trac.sagemath.org/sage_trac/ticket/8074

I've posted the major cleanup and documentation of RR code, plus code for setting printing options (truncate, skip_zeroes, etc.) on a global default or per-ring basis here: http://trac.sagemath.org/sage_trac/ticket/7682

What should these corner cases return? Do you agree with the current answers?

sage: RR('inf').is_real()
True
sage: RR('nan').is_real()
True
sage: RR('inf').is_unit()
True
sage: RR('nan').__nonzero__()
False
sage: RR('nan')==RR('nan')
True


sage: RR('-inf').__pow(0.5)
+infinity

note that this is returned by the actual sqrt function:

sage: sqrt(RR('-inf'))
+infinity*I


And you probably don't agree with this next one:

sage: RR('nan').__pow(0.5)
Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.RuntimeError'> ignored
^CERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
File "/home/grout/sage/local/lib/python2.6/site-packages/IPython/ultraTB.py", line 614, in text
    records = _fixed_getinnerframes(etb, context,self.tb_offset)
File "/home/grout/sage/local/lib/python2.6/site-packages/IPython/ultraTB.py", line 230, in _fixed_getinnerframes records = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) File "/home/grout/sage/local/lib/python/inspect.py", line 942, in getinnerframes
    framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
File "/home/grout/sage/local/lib/python/inspect.py", line 902, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
File "/home/grout/sage/local/lib/python/inspect.py", line 451, in getsourcefile
    if hasattr(getmodule(object, filename), '__loader__'):
File "/home/grout/sage/local/lib/python/inspect.py", line 485, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
File "/home/grout/sage/local/lib/python2.6/site-packages/sage/interfaces/get_sigs.py", line 9, in my_sigint
    raise KeyboardInterrupt
KeyboardInterrupt

Unfortunately, your original traceback can not be constructed.

Thanks,

Jason


--
Jason Grout

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to