root/applications/pmsm/simulator_zdenek/round_test.cpp
@
1401
Revision 1344, 283 bytes (checked in by smidl, 14 years ago) |
---|
Line | |
---|---|
1 | /* test od rounding in fixed point */ |
2 | |
3 | #include <stdio.h> |
4 | int main(){ |
5 | int n; |
6 | // n is number in q3 |
7 | printf (" n , double(n/8), n>>3, (n+(1<<2))>>3 \n"); |
8 | for (n=-8; n<8; n++){ |
9 | printf ("%2d, %1.2f, %2d, %2d\n", n , double(n)/8, n>>3, (n+(1<<2))>>3); |
10 | } |
11 | return 0; |
12 | } |
Note: See TracBrowser
for help on using the browser.