Skip to content

Commit ad437bf

Browse files
committedAug 29, 2012
use qRound() for round()
1 parent f006b23 commit ad437bf

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed
 

‎src/core/qgsexpression.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@
2929
#include "qgsgeometry.h"
3030
#include "qgslogger.h"
3131

32-
//non qt includes
33-
#include <cmath>
34-
35-
#ifdef _MSC_VER
36-
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
37-
#endif
38-
3932
// from parser
4033
extern QgsExpression::Node* parseExpression( const QString& str, QString& parserErrorMsg );
4134

@@ -782,13 +775,13 @@ static QVariant fcnRound( const QVariantList& values , QgsFeature *f, QgsExpress
782775
{
783776
double number = getDoubleValue( values.at( 0 ), parent );
784777
double scaler = pow( 10.0, getIntValue( values.at( 1 ), parent ) );
785-
return QVariant( round( number * scaler ) / scaler );
778+
return QVariant( qRound( number * scaler ) / scaler );
786779
}
787780

788781
if ( values.length() == 1 )
789782
{
790783
double number = getIntValue( values.at( 0 ), parent );
791-
return QVariant( round( number) ).toInt();
784+
return QVariant( qRound( number) ).toInt();
792785
}
793786

794787
return QVariant();

0 commit comments

Comments
 (0)
Please sign in to comment.