Page 1 of 1

Variation codes not turning out the way we intended

Posted: Thu Aug 10, 2006 9:26 pm
by MtnViewJohn
The way we intended variation codes to work is that a given variation of a cfdg file will look the same everywhere. But recently Mark compiled Context Free using Intel's new compiler for Mac OS X and variations looked different.

It turned out that Intel's compiler was generating code that causes slight differences in the least significant bits of double precision numbers. These minor differences in the FP numbers shouldn't have any effect. But it turns out that the random number generator in Context Free is affected by these incredibly small changes. The random number generator in Context Free generates a tree of random numbers instead of a sequence. Each node of this tree is associated with a shape and we exclusive-OR the affine transform of the shape into the random number seed to improve randomness. GCC and Microsoft VC++ generate affine transforms that are bitwise identical. But Intel's compiler generates slightly different numbers that throw off the random number generator.

In hindsight it is obvious that XORing FP numbers into the random number seed would never produce a globally uniform random number generator. The only way we can make the random number generator globally uniform is to XOR in a value derived directly from the ASCII characters of the cfdg file, using only integer math.

What this means for CF users is that the random number generator is getting tweaked and this will change what all the variations look like. We hope that the random number generator will not need to change after this and that variations will now be stable.