Author mark.dickinson
Recipients christian.heimes, mark.dickinson, skip.montanaro
Date 2008-12-07.12:42:40
SpamBayes Score 1.55431e-15
Marked as misclassified No
Message-id <1228653764.46.0.349797077595.issue4575@psf.upfronthosting.co.za>
In-reply-to
Content
In issue 4506, Skip reported that test_cmath fails on Solaris 10/x86 for 
3.0.  If my guesses are correct, it probably fails on all x86 systems that 
(a) use the x87 coprocessor for floating-point (as opposed to using SSE2, 
for example), and (b) don't have isinf available.

Problem: Py_IS_INFINITY is applied to a floating-point value sitting in an 
80-bit x87 register; that value is not infinity, but after moving it back 
to memory (and hence rounding from 80-bit extended precision to 64-bit 
double precision with its smaller exponent range) it becomes infinity.

Solution: Add a macro to pymath.h that forces rounding from extended 
precision to double precision; apply this macro *before* calling 
Py_IS_INFINITY.  See attached patch for an example.

Problem: After applying the attached patch to the py3k branch, the cmath 
module fails to build.  On OS X 10.5, I get:

running build_ext
building 'cmath' extension
gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-
3.1/Users/dickinsm/python_source/py3k/Modules/cmathmodule.o -
L/usr/local/lib -o build/lib.macosx-10.3-i386-3.1/cmath.so
*** WARNING: renaming "cmath" since importing it failed: 
dlopen(build/lib.macosx-10.3-i386-3.1/cmath.so, 2): Symbol not found: 
_Py_force_to_memory
  Referenced from: /Users/dickinsm/python_source/py3k/build/lib.macosx-
10.3-i386-3.1/cmath.so
  Expected in: dynamic lookup

Solution: ???

Christian, as the architect of pymath.h, do you have any ideas what I'm 
doing wrong?  Or comments on the patch in general?  What do I need to do 
to make Py_force_to_memory visible to extension modules?
History
Date User Action Args
2008-12-07 12:42:44mark.dickinsonsetrecipients: + mark.dickinson, skip.montanaro, christian.heimes
2008-12-07 12:42:44mark.dickinsonsetmessageid: <1228653764.46.0.349797077595.issue4575@psf.upfronthosting.co.za>
2008-12-07 12:42:43mark.dickinsonlinkissue4575 messages
2008-12-07 12:42:41mark.dickinsoncreate