use qRound() for round()

This commit is contained in:
Juergen E. Fischer 2012-08-29 09:23:30 +02:00
parent f006b234e7
commit ad437bfdff

View File

@ -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();