Hashing 3 floats
Hi!
I have a list of float triplets and I need to make some sort of hash value (int) from each triplet. I need an algorithm that produces different hash values even for slightly different floats... Any ideas?
Thanks
int value = *((unsigned int *)&the_float);
then hash the value with appropriate hash function
then hash the value with appropriate hash function
I just use a standard CRC function (look up "pkzip CRC").
You could also do something like this though it is probably no faster:
You could also do something like this though it is probably no faster:
srand( *(int *)&float1 ); srand( rand() ^ *(int *)&float2 ); srand( rand() ^ *(int *)&float3 ); hash = rand();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement