Page 1 of 1


Posted: Fri Feb 11, 2011 2:14 pm
by Kjell

For people wondering how this ( the library ) would even be possible in ZGE. There's a "oddity" in the compiler that you can exploit to cast integers to floats ( and vice versa ).

For example, when assigning a hex-value to a float normally, the value gets converted from a integer to a float.

Code: Select all

float x = 0x3eaaaaab; // x = 1051372224
However, in conditional assignments the data type is determined by the first variable, which allows you to force a bit-string to be interpreted as float.

Code: Select all

float x = 0 ? 0f : 0x3eaaaaab; // x = 1/3