mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
use qRound() for round()
This commit is contained in:
parent
f006b234e7
commit
ad437bfdff
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user