casts to get rid of warnings
change code to compare dbls as uint64 to bypass bug in gcc 3.4.3 on solaris.  New code is clearer anyway...