1
by mental
moving trunk for module inkscape |
1 |
#ifndef SEEN_ROUND_H
|
2 |
#define SEEN_ROUND_H
|
|
3 |
||
4 |
#include <cmath> |
|
5 |
||
6 |
namespace Inkscape { |
|
7 |
||
8 |
/** Returns x rounded to the nearest integer. It is unspecified what happens
|
|
9 |
if x is half way between two integers: we may in future use rint/round
|
|
10 |
on platforms that have them. If you depend on a particular rounding
|
|
11 |
behaviour, then please change this documentation accordingly.
|
|
12 |
**/
|
|
13 |
inline double |
|
14 |
round(double const x) |
|
15 |
{
|
|
16 |
return std::floor( x + .5 ); |
|
17 |
}
|
|
18 |
||
19 |
}
|
|
20 |
||
21 |
#endif /* !SEEN_ROUND_H */ |
|
22 |
||
23 |
/*
|
|
24 |
Local Variables:
|
|
25 |
mode:c++
|
|
26 |
c-file-style:"stroustrup"
|
|
27 |
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
|
|
28 |
indent-tabs-mode:nil
|
|
29 |
fill-column:99
|
|
30 |
End:
|
|
31 |
*/
|
|
32 |
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|