Chris MacRaild wrote:
On Sat, 2006-08-05 at 00:08 +1000, Edward d'Auvergne wrote:
2) there is an external module called fpconst which supplies similar
functionality. This relies on the python struct module to compare the
underlying bit sequence with the IEEE 754 standards. It seems to work
well on my machine, and I think most platforms should be compliant at
that level, but I'm not sure and I have limited opportunity to test
other platforms. On the up side the module is relatively small, and
could be incorporated into relax, so it need not be a dependency (its
under the Apache Licence).
Would this module be useful for NaNs generated by the current code?
Does it replace the inbuilt Python NaNs with it's own NaNs? The
module's web page seems to be down at the moment.
fpconst won't override the inbuilt Python NaNs, but on the two machines
I have briefly tested it on, fpconst.isNaN() gives the right answer with
Python NaNs. So it will be useful in that it allows us to test output
from the current code for the pressence of NaNs. It does not provide a
complete and coherent set of NaN behaviour, though. This we might get
from Numpy, but I'm not absolutely sure.
Chris
It ought to be said that nan and inf etc have very clearly defined bit
patterns in memory that are defined by an ieee754 cf
http://steve.hollasch.net/cgindex/coding/ieeefloat.html and
http://www.psc.edu/general/software/packages/ieee/ieee.html. Thus its a
question of python/compilers not putting nan in the right place and not
using comaprisons etc properly when nans are are present. It should
always be possible to detect if a nan is present by the bit pattern in
memory (and this is the way fpconst.py does it). It is of course
possible to test if nans are supported correctly on a paricular
architecture and compiler by comparisons etc and if not warnings etc
could be raised or alternative code executed)
another thing to say is that though fpconst.py is gpl incompatible due
to some arcana about /patent termination cases
(http://en.wikipedia.org/wiki/Apache_License)/ in the apache license,
due to they way it works should be relativley easy to cook up our own
version which would bullet proof and low maintenance in the same way as
fpconst.py is... and also quite legal
regards
gary
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-devel mailing list
relax-devel@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel
.
--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK Tel. +44-113-3433024
email: garyt@xxxxxxxxxxxxxxx Fax +44-113-2331407
-------------------------------------------------------------------