mailRe: float.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on October 12, 2006 - 12:58:
What an awesome effort Gary!!!  That code is brilliant!

On 10/12/06, Gary S. Thompson <garyt@xxxxxxxxxxxxxxx> wrote:
Dear Ed and all

I have committed a revision which has functions for dealing with
ieee-754 doubles. There are a few points to note:

1. this does much more than the required task and covers most states of
python floats. This is because having sorted through how a ieee number
works it seemed easier to do all the 'float things' while I had my head
round it

The number of floating point functions is unbelievable, these should come in very handy in the future. Thank you. Maybe after a bit of polish you should consider submitting it for inclusion into Python. 'fpconst' is one day going into Python, but this code is a much more advanced and complete implementation!


2. it is a set of functions rather than a class as there seems to be no
reason to have a class...

Do you think it'll be sufficient to import the appropriate functions by the module requiring the test?

3. as shown in the notes there are some things still to do

I've played around with it on both GNU/Linux and MS Windows XP and the 'isInf()' and 'isNaN()' functions return the correct value each time. Unit tests would be a much more thorough way of testing it though. I have been thinking about extending the relax test-suite to be three-tiered: unit tests, functional or system tests, and regression tests. Python has a decent unit test framework (called 'unittest'). These ideas should probably be discussed on another thread though. If I was to integrate the unit test framework into relax, would you be interested in writing unit tests for these new functions?

4. I haven't alterered
specific_fns/.svn/text-base/model_free.py.svn-base:            #if
self.relax.float.isnan(self.func):
specific_fns/model_free.py:            #if
self.relax.float.isnan(self.func):

yet

There are a few minor things which need to be sorted out. The first thing is that relax no longer starts up. This is easy to fix though, just delete the import line, etc. from the file 'relax'. The other problem is this message:

DeprecationWarning: Non-ASCII character '\xe2' in file
/mnt/removable/relax/float.py on line 35, but no encoding declared;
see http://www.python.org/peps/pep-0263.html for details

The easy fix is to use standard ASCII characters to represent the
text.  There are four instances where a Unicode (I'm assuming)
character appear in your new code.  The next thing is import 'isInf'
and 'isNaN' into 'specific_fns/model_free.py' and uncomment the two
lines.

Gary would you like to make these three easy changes?  I probably
won't have repository access until tomorrow.  Thanks.

The following paragraph is just about cosmetic changes and the style
of the code.  I hope I don't offend, these are just standard relax
conventions.  One point which would be of benefit for future relax
developers (and possibly if you forget as well) is:  would it be
possible to get a few more comments '# ...' interspersed within the
code of each function describing in plain English what each part of
the code is attempting to do?  The functions jump around a lot calling
each other and a few more comments would make it easier to navigate
the code execution.  I know that the amount of comments in relax is
ridiculous when compared to other code, but these comments do help
those who aren't fully fluent in Python to follow what is happening.
It would be very much appreciated.  Would you mind making a few
cosmetic whitespace fixes to the trailing whitespace, leading
whitespace, number of newlines between functions, etc. for
consistency?  As it is a package which can be imported into the
different parts of relax, it isn't too important that the docstrings,
etc. don't match the relax conventions.  Did you use one of the
standard conventions with the 'obj', 'returns', and 'throws'
descriptions in the docstrings?

Thank you very much again,

Edward



Related Messages


Powered by MHonArc, Updated Thu Oct 12 18:40:22 2006