Opened 15 years ago
Closed 15 years ago
#468 closed defect (fixed)
[with patch] quaddouble wrapper sets fpu precision to 53 bits for entire sage session
Reported by: | bober | Owned by: | bober |
---|---|---|---|
Priority: | major | Milestone: | sage-2.8.7 |
Component: | basic arithmetic | Keywords: | quaddouble, fpu, ReadQuadDouble |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage/rings/real_rqdf.pyx contains the following code:
cdef class RealQuadDoubleField_class(Field): """ Real Quad Double Field """ def __init__(self): fpu_fix_start(self.cwf) def __dealloc__(self): fpu_fix_end(self.cwf)
On systems where fpu_fix_start()
does something, it sets the fpu precision to 53 bits. A poor side effect of this is that the type long double
ought to have 64 bits of precision on some systems, but it doesn't when it is used in code run from SAGE.
The short term fix will be to rewrite the wrapper to have an fpu_fix_start() and fpu_fix_end() call before and after every arithmetic operation on a RealQuadDouble
element, and nowhere else, to make sure that the quaddouble wrapper doesn't ever unexpected change the fpu precision.
It would also be nice to have a doctest that can check the fpu precision, so it can be checked that nothing ever changes it unexpectedly.
Attachments (2)
Change History (7)
Changed 15 years ago by
Changed 15 years ago by
x86 specific fpu stuff -- see ticket discussion (this should NOT be included in sage)
comment:1 Changed 15 years ago by
The attachment 5835-fpu-status.patch
provides a module for checking/setting the fpu precision on an x86 processor, which can be useful for debugging problems like this one. Some example usage of this patch:
sage: import sage.misc.fpu as fpu sage: fpu.get_precision() 'extended' sage: fpu.set_double_precision() sage: fpu.get_precision() 'double' sage: fpu.set_single_precision() sage: fpu.get_precision() 'single' sage: fpu.set_extended_precision() sage: fpu.get_precision() 'extended'
This patch should NOT be included in sage currently, as it relies on an x86 processor to function, and also just isn't written very nicely in general.
comment:2 Changed 15 years ago by
- Component changed from algebraic geometry to basic arithmetic
comment:3 Changed 15 years ago by
- Milestone set to sage-2.9
comment:4 Changed 15 years ago by
- Milestone changed from sage-2.9 to sage-2.8.7
- Summary changed from quaddouble wrapper sets fpu precision to 53 bits for entire sage session to [with patch] quaddouble wrapper sets fpu precision to 53 bits for entire sage session
comment:5 Changed 15 years ago by
- Resolution set to fixed
- Status changed from new to closed
This patch should fix this issue.