"No matter what he does, there will always be gaps."
Here is how to do this [1]: keep a fixed-size array of every number seen, and store numbers as index into the array. When or if [2] the array fills up, garbage collect by finding a number in the array that is fairly close and hasn't been used recently, and updating it to contain the value you need _now_. Yes, that may change values computed some time ago, but who cares? Your unit tests will run fine, it teaches you to defend your code against bits flipping in RAM, and it is not as if you remember that that fish you caught months ago was 1.8 meters long and not sqrt(3) meter.
[1] if you like designing esoteric languages.
[2] it wouldn't terribly surprise me to learn that many programs do not need that many different float values to survive long.
I'm missing something here. Is the point of this system to use the same floating point value in several different places without storing it in several different places? Why not just use a pointer? If the array is fixed-size, where are you storing e.g. the fact that 01110010 is actually 3.79017423523459?
Here is how to do this [1]: keep a fixed-size array of every number seen, and store numbers as index into the array. When or if [2] the array fills up, garbage collect by finding a number in the array that is fairly close and hasn't been used recently, and updating it to contain the value you need _now_. Yes, that may change values computed some time ago, but who cares? Your unit tests will run fine, it teaches you to defend your code against bits flipping in RAM, and it is not as if you remember that that fish you caught months ago was 1.8 meters long and not sqrt(3) meter.
[1] if you like designing esoteric languages.
[2] it wouldn't terribly surprise me to learn that many programs do not need that many different float values to survive long.