On Tue, Jan 12, 2010 at 12:13 PM, Isaac Dupree <[email protected]> wrote: > Rob Farmer wrote: >> Line 323 in util.c is: >> if( (float)(h->count+1)/h->size > 0.75f ) >> The problem is, the first time this is run, the hash table (h) is >> empty, so h->size is 0 and you get a divide by zero error. I'm not >> sure why this is only appearing on NetBSD, > > sometimes (some platforms?) floats raise NaN and don't signal. But > really, the thing here to do is DON'T DIVIDE BY ZERO!
Interesting - thanks for the info. Out of curiosity - what architecture is the machine you are trying to build fish on chombee? I'm wondering if I need to patch this for FreeBSD on non-i386 architectures. -- Rob Farmer > > e.g. with a bit of algebra, assuming h->size is nonnegative, this is > quite equivalent: > if( (float)(h->count+1) > 0.75f * h->size ) > or even, does it need to use floats?: > if( (h->count+1) > h->size*3/4 ) > or > if( (h->count+1)*4 > h->size*3 ) > > if you really want to divide for some aesthetic or practical reason, > then check whether (h->size == 0) first. > > -Isaac > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Fish-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/fish-users > ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
