The numerical instability is very high when converting from long to float in range(-1,1) and then back to long. So much so that approximately 15% of the numbers are converted incorrectly.
What is more interesting is that for specific K, there are no numerical instability issues, and some of the K seem to be prime numbers as well.
The results are very consistent. Any ideas on numerically stable normalization?