If you want to search for more significant digits, you probably should multiply it up like we currently do for the ratio part and do the comparison on whole numbers. Otherwise you probably will not get a match because the real number is slighly different.
There are probably still a few small bugs in my code (I already found a few). maybe I have time to do some more tweaks over the weekend.
Yes, 32 bit operations are definitely faster than 64 bit operations, but there are also a few other optimizations.
LUT:
lookup table. I create an array outside the main loop (at the start of the program) that contains the number of set bits for all 16bit numbers. Indexing into the array with any number up to 2^16-1 will return the number of set bits. To count the number of true bits for any given 32 bit numbers, we just split it in two 16 bit parts and index each into the array and add the two resulting elements. This is faster than creating a boolean array, converting to 0,1, and adding the array elements at each of the 2^32 iterations of the loop. Calculating the lookup table is very fast (only 2^16 iterations) and is done only once. (We could of course also use a tiny 8bit lookup table and split the number fourways. OTOH, a single 32bit lookup table would be too big for todays computers and OSs. ;))
This is especially important if we filter based on a large "min segments" value, because then we can reject many numbers right away and we don't even need to do the detailed calculations for those.