FixedMul

From ZDoom Wiki
Jump to: navigation, search

fixed FixedMul (int a, int b)

Usage

Returns the fixed point result of multiplying two fixed point numbers.

Parameters

Return value

The result of fixed point numbers multiplication.

Examples

You cannot use normal multiplication operator on fixed point numbers. See the results of this example:

script 1 (void)
{
    Print (f: FixedMul (0.5, 0.5)); // 0.25
    Print (f: 0.5 * 0.5);           // 16384
}

However, multiplying a fixed point number a by an integer b yields a fixed point value still, and one must not use FixedMul in this case:

script 2 (void)
{
        int z = 1.2 * 3;
        print(f:z);                  /* 3.6 or so */
}

See also