FixedDiv

fixed FixedDiv (int a, int b)

Usage

Returns the fixed point result of dividing fixed point a by fixed point number b.

Parameters

Return value

The result of fixed point numbers dividing.

Examples

You cannot use normal division operator on fixed point numbers when you expect the result to be fixed point number too. See the results of this example:

script 1 (void)
{
    Print (f: FixedDiv (1.0, 0.5)); // 2
    Print (f: 1.0 / 0.5);           // 0.000030518
}

However, dividing a fixed point number a by an integer b yields a fixed point value still, and FixedDiv must not be used in this case:

script 2 (void)
{
        int z = 1.0 / 3;
        print(f:z);                  /* 0.333 */
}

See also

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.