Skip to content
Permalink
Browse files

use qRound() for round()

  • Loading branch information
jef-n committed Aug 29, 2012
1 parent f006b23 commit ad437bfdffdd712a4a41b4f59a47c795bbefe208
Showing with 2 additions and 9 deletions.
  1. +2 −9 src/core/qgsexpression.cpp
@@ -29,13 +29,6 @@
#include "qgsgeometry.h"
#include "qgslogger.h"

//non qt includes
#include <cmath>

#ifdef _MSC_VER
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
#endif

// from parser
extern QgsExpression::Node* parseExpression( const QString& str, QString& parserErrorMsg );

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

if ( values.length() == 1 )
{
double number = getIntValue( values.at( 0 ), parent );
return QVariant( round( number) ).toInt();
return QVariant( qRound( number) ).toInt();
}

return QVariant();

0 comments on commit ad437bf

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