Skip to content

Commit 0da1e33

Browse files
committedSep 18, 2018
Use qgsRound in some more places
1 parent 992fe4d commit 0da1e33

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed
 

‎src/core/expression/qgsexpressionfunction.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,8 +3403,7 @@ static QVariant fcnRound( const QVariantList &values, const QgsExpressionContext
34033403
if ( values.length() == 2 && values.at( 1 ).toInt() != 0 )
34043404
{
34053405
double number = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
3406-
double scaler = std::pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
3407-
return QVariant( std::round( number * scaler ) / scaler );
3406+
return qgsRound( number, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
34083407
}
34093408

34103409
if ( values.length() >= 1 )

‎src/core/layout/qgslayoutitemmapgrid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ QString QgsLayoutItemMapGrid::gridAnnotationString( double value, QgsLayoutItemM
13761376
{
13771377
QString hemisphere;
13781378

1379-
double coordRounded = std::round( value * std::pow( 10.0, mGridAnnotationPrecision ) ) / std::pow( 10.0, mGridAnnotationPrecision );
1379+
double coordRounded = qgsRound( value, mGridAnnotationPrecision );
13801380
if ( coord == QgsLayoutItemMapGrid::Longitude )
13811381
{
13821382
//don't use E/W suffixes if ambiguous (e.g., 180 degrees)

0 commit comments

Comments
 (0)
Please sign in to comment.