gmpy floating point exception

Alex Martelli aleax at mac.com
Thu Mar 29 03:57:03 EDT 2007


Martin Manns <mmanns at gmx.net> wrote:

> Hi,
> 
> I am experiencing some trouble with gmpy v1.01.
> Multiplying an mpq with inf results in a floating point exception that
> exits python. Has this already been fixed in newer gmpy versions? 

No, I can reproduce the problem (on a Mac with an Intel CPU) with the
current version, 1.02.  I will have no time to work for a fix until (I
hope) next week, though (spending a long weekend hitch-hiking).

> BTW.
> 1) What is the best way to test for inf regardless of type?

No, 'inf' is in fact not portable among different builds of Python for
different CPUs, in general.

> 2) Is there any inf type around with
> a + inf == inf
> inf > a (as long as a != inf)
> etc.
> that works with any other type?

You mean something like:

class inf(object):
    def __radd__(self, other): return self
    def __gt__(self, other): return self is not other
    # etc
inf = inf()

...?


Alex



More information about the Python-list mailing list