From ZDoom Wiki
Jump to navigation Jump to search

fixed FixedDiv (int a, int b)


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


Return value

The result of fixed point numbers dividing.


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