4 Copyright (c) 2010 Lode Vandevenne
7 This file is part of OOPoker.
9 OOPoker is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 OOPoker is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with OOPoker. If not, see <http://www.gnu.org/licenses/>.
25 int getNearestRoundNumber(int i
)
28 else if(i
< 2) return 1;
29 else if(i
< 5) return 2;
30 else if(i
< 10) return 5;
31 else if(i
< 20) return 10;
32 else if(i
< 50) return 20;
33 else if(i
< 100) return 50;
34 else if(i
< 200) return 100;
35 else if(i
< 500) return 200;
36 else if(i
< 1000) return 500;
37 else if(i
< 2000) return 1000;
38 else if(i
< 5000) return 2000;
39 else if(i
< 10000) return 5000;
40 else if(i
< 20000) return 10000;
41 else if(i
< 50000) return 20000;
42 else if(i
< 100000) return 50000;
43 else if(i
< 200000) return 100000;
44 else if(i
< 500000) return 200000;
45 else if(i
< 1000000) return 500000;
46 else if(i
< 2000000) return 1000000;
47 else if(i
< 5000000) return 2000000;
48 else if(i
< 10000000) return 5000000;
49 else if(i
< 20000000) return 10000000;
50 else if(i
< 50000000) return 20000000;
51 else if(i
< 100000000) return 50000000;
52 else if(i
< 200000000) return 100000000;
53 else if(i
< 500000000) return 200000000;
54 else if(i
< 1000000000) return 500000000;
55 else if(i
< 2000000000) return 1000000000;
56 else return 2000000000;
57 //32-bit integers can't be bigger than that.