docs/examples/fixed_ex.cpp
branchgamebalance
changeset 9876 f8302fbd236d
equal deleted inserted replaced
9875:11068d555904 9876:f8302fbd236d
       
     1 /* $Id */
       
     2 
       
     3 #include "fixedt.h"
       
     4 
       
     5 int main()
       
     6 {
       
     7 	/* a is a Fixed-Point variable with 48 integral bits
       
     8 	 * and 16 fractional bits, automatically set to zero
       
     9 	 */
       
    10 	FixedT<int64, 16> a;
       
    11 
       
    12 	/* Assuming int is 32 bits, gives a variable of 23
       
    13 	 * integral bits and 9 fractional bits, initialized
       
    14 	 * to -4
       
    15 	 */
       
    16 	FixedT<int, 9> b = -4;
       
    17 
       
    18 	/* A Variable set to a non-integral number
       
    19 	 * in this case, -12.8
       
    20 	 */
       
    21 	FixedT<long int, 12> c(-128, 10);
       
    22 }