#5689: [with patch; needs review] hitting control c while computing pi results
in
wrong answers later
------------------------------+---------------------------------------------
Reporter: was | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: sage-3.4.1
Component: basic arithmetic | Keywords:
------------------------------+---------------------------------------------
Comment(by was):
This patch resolves this problem completely, but has a performance
penalty:
{{{
BEFORE:
sage: a = RealField(1000)
sage: timeit('a.pi()')
625 loops, best of 3: 3.4 µs per loop
AFTER:
sage: a = RealField(1000)
sage: timeit('a.pi()')
625 loops, best of 3: 64.4 µs per loop
}}}
Of course the difference in time is because the answer is being 100%
cached in the first place.
I tried catching the interrupt, as carl suggests, but that isn't easy in
Cython without writing a whole new sig handler system like Gonzalo T. and
I did for the pari gen.pyx file, and that is pretty painful.
Note -- there is one way to defeat the attached patch: (1) hit control c
during computation of a constant, then (2) call some other mpfr function
that assumes that internally does compute one of these constants. Thus
this patch is not bullet proof. I'm posting it since it seems better than
nothing, resolves the immediate problem, and was totally trivial to write.
-- William
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5689#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en
-~----------~----~----~----~------~----~------~--~---