[SciPy-dev] numpy.float128 absence yield bugs

Matthieu Brucher matthieu.brucher@gmail....
Mon Mar 10 08:02:37 CDT 2008


>
>
> > If you do not need a direct call to float128 in your condition, you
> > can easily make it compatible on all platforms.
> > Do not import numpy with "from numpy import ...", but only "import
> > numpy", make your decision based on cond and the presence of float128
> > ('float128' in dir(numpy)) and everything will be fine ;)
> >
> > Matthieu
>
> I still think if something is wrong with
> from numpy import ...
> than it should be found and fixed instead of avoiding the one and
> proposing the solution to other numpy users/programmers.
> I guess putting the checks ... in dir(numpy) or hasattr(numpy, float128)
> everywhere isn't a best solution.
>

The issue is that not every platform has a float128 library, so either you
make it available to noone so that such error cannot be raised, either you
add some code in case you really need it and it is available.
If float128 is implemented in a bogus way and your condition is true, there
will be another issue and you will ask for a complete implementation, which
will never be the case. I think that your best shot is with making with what
is available, with its advantages and drawbacks, and that means testing for
the existence of float128 if you need it.

Matthieu
-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20080310/b968637d/attachment-0001.html 


More information about the Scipy-dev mailing list