introduce distance between double and Sample on IDistance

This commit includes adaptions to the implementation changes.
fix comparison to Double.NaN

Since NaN is compared by bits, the Double.compare method must be used.
fix some bugs and make code more safe to arithmetic errors
use k-means in main