[emboss-dev] Upper limit to "floats" - Checked by AntiVir DEMO vers
pmr at ebi.ac.uk
Fri Mar 2 13:40:26 UTC 2007
Guy Bottu wrote:
> On Fri, Mar 02, 2007 at 12:20:08PM +0000, Peter Rice wrote:
>> Curious. This error suggests you have called ajMemCalloc with a request
>> for an array of zero (or negative) length.
>> I suspect you have exceeded the size of an integer. It does not look like
>> a floating point problem.
> Actually, the ACD contains :
> float: effdbsize [
> information: "Effective databank size for statistical
> minimum: "0.0"
> and the program :
> float CLfloat; /* real number on command line */
> embInit ("blast2seq", argc, argv);
> (here it crashes)
Aha ... and it crashes in valgrind too.
Excellent timing, just as we are thinking about 4.1.0.
Is this a problem with the current CVS code? We made changes to the way this
works, so 4.0.0 seems to have no problem.
The problem is in function ajStrFromFloat where converting the float to a string
goes through extracting the absolute value as an integer to work out how long
the string needs to be. We do this because all ACD values are stored as strings
To fix it, in ajmath.c look at functions ajNumLengthFloat and ajNumLengthDouble
and replace int with long, and replace UINT_MAX wth ULONG_MAX
Fixed in 4.1.0 and I will commit ajmath.c once the QAtests complete (they take
rather longer than they used to now - we added a lot more memory tests :-)
More information about the emboss-dev