Mercator
iround.h
1 // This file may be redistributed and modified only under the terms of
2 // the GNU General Public License (See COPYING for details).
3 // Copyright (C) 2003 Alistair Riddoch
4 
5 #ifndef MERCATOR_IROUND_H
6 #define MERCATOR_IROUND_H
7 
8 #ifndef PACKAGE_NAME
9 #error iround.h must be included after config.h
10 #endif
11 
12 // FIXME tr1 contains std::tr1::lrint which is type overloaded
13 // In c++0x this becomes std::lrint
14 
15 #ifdef HAVE_LRINTF
16  #define I_ROUND(_x) (::lrintf(_x))
17 #elif defined(HAVE_RINTF)
18  #define I_ROUND(_x) ((int)::rintf(_x))
19 #elif defined(HAVE_RINT)
20  #define I_ROUND(_x) ((int)::rint(_x))
21 #else
22  #define I_ROUND(_x) ((int)(_x))
23 #endif
24 
25 #endif // MERCATOR_IROUND_H