Skip to content
Permalink
Browse files

Introduce qgsRound since std::round is available only in C++11 onwards

(cherry-picked from 468012a)
  • Loading branch information
nyalldawson committed Nov 19, 2015
1 parent f16328a commit 3ffdb6cf872d9012f41c11b74ecd2c16266c072f
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/core/qgis.h
@@ -351,6 +351,14 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
qRound( ar * pow( 10.0, significantDigits ) ) == qRound( br * pow( 10.0, significantDigits ) );
}

//
// a round function which returns a double to guard against overflows
//
inline double qgsRound( double x )
{
return x < 0.0 ? std::ceil( x - 0.5 ) : std::floor( x + 0.5 );
}

bool qgsVariantLessThan( const QVariant& lhs, const QVariant& rhs );

bool qgsVariantGreaterThan( const QVariant& lhs, const QVariant& rhs );

0 comments on commit 3ffdb6c

Please sign in to comment.
You can’t perform that action at this time.