[Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison)

Huaiyu Zhu hzhu at yahoo.com
Thu Oct 12 19:52:51 EDT 2000


On Thu, 12 Oct 2000 19:24:18 +0200, hinsen at dirac.cnrs-orleans.fr
<hinsen at dirac.cnrs-orleans.fr> wrote: 
>
>So how about making this a run-time option? I'd choose exceptions by
>default and Infs and Nans by specifying a command-line option, but
>there are certainly others who would prefer it the other way round.
>What matters most to me is that the choice is possible somehow.

So there is complete harmony here from number-crunchers. :-)
Here's just a little thought about how that might be done:

In mathmodule.c define math_1_check, math_1_nocheck, math_2_check, and
math_2_nocheck.  Let math_1=math_1_check as default, if you will.

If I want a different behavior, I could do:
import math
math.math_1 = math.math_1_nocheck
math.math_2 = math.math_2_nocheck

Or even a function the sets this up for me:
math.do_not_check_fp_exception()

I don't know how much runtime overhead this would be.  Does it only involve
one extra C function call or does it involve a Python function call?

The advantage is that this is completely under user control, in a level that
is platform independent, and the user only needs to set the default once per
python session, but he could also change it as many times as he want.

Huaiyu



More information about the Python-list mailing list