From: Tim P. <ti...@co...> - 2002-03-04 08:41:16
|
A lot of this speculation should have been cut short by my first msg. Yes, something changed in 2.2; follow the referenced link: http://sf.net/tracker/?group_id=5470&atid=105470&func=detail&aid=496104 For the rest of it, it looks like the "1e-200**2 raises OverflowError" glitch is unique to platforms using glibc. What isn't clear is whether it's dependent on which version of glibc, or on whether Python is linked with -lieee, or both. Unfortunately, the C standard (neither one) isn't a lick of help here -- error reporting from C math functions is a x-platform crapshoot. Can someone who sees this problem confirm or deny that they link with -lieee? If they see this problem and don't link with -lieee, also please try linking with -lieee and see whether the problem goes away then. On boxes with this problem, I'm also curious what import math print math.pow(1e-200, 2.0) does under 2.1. One probably-relevant thing that changed between 2.1 and 2.2 is that float**int calls the platform pow(float, int) in 2.2. 2.1 did it with repeated multiplication instead, but screwed up endcases. An example under 2.1: >>> x = -1. >>> import sys >>> x**(-sys.maxint-1L) Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: negative number cannot be raised to a fractional power >>> The same thing under 2.2 returns 1.0, provided your platform pow() isn't braindead. Repeated multiplication is also less accurate than a decent-quality pow(). |