Fixed point numbers
From ZDoom Wiki
(Redirected from Fixed point)
ZDoom commonly represents fixed point numbers as 32-bit integers with the integer part of the represented number stored in the top 16 bits, and with the fractional part (65536ths) stored the lower 16 bits.
In other words, the fixed point representation of a number = that number * 65536.
To do multiplies and divides on fixed point numbers in ACS scripts, you can use functions such as FixedMul and FixedDiv.
You can convert an integer to a fixed point representation of that integer simply by shifting your desired integer left 16 bits:
int myCoolInteger = 72; int myCoolFixedPointValue = myCoolInteger << 16;
Going the other way is just as easy...
int myCoolFixedPointValue = 4718592; int myCoolInteger = myCoolFixedPointValue >> 16;
You can also specify fixed point numbers as literals in ACS scripts:
int myFixedPointNumber = 1.5;
myFixedPointNumber is now (1.5 * 65536) = 98304
See also Definitions

