Skip to content
Permalink
Browse files

Swap q(pow) -> std::pow

  • Loading branch information
nyalldawson committed Aug 24, 2017
1 parent 77c3be9 commit 031bf41d1b8f501a0ece0e10fb75f664bad80352
Showing with 112 additions and 112 deletions.
  1. +1 −1 src/analysis/interpolation/CloughTocherInterpolator.cc
  2. +1 −1 src/analysis/interpolation/MathUtils.cc
  3. +1 −1 src/analysis/interpolation/qgsidwinterpolator.cpp
  4. +11 −11 src/analysis/raster/qgskde.cpp
  5. +1 −1 src/analysis/raster/qgsrastermatrix.cpp
  6. +1 −1 src/analysis/vector/qgszonalstatistics.cpp
  7. +1 −1 src/app/qgsdecorationgrid.cpp
  8. +1 −1 src/app/qgsdecorationscalebar.cpp
  9. +1 −1 src/core/composer/qgscomposermapgrid.cpp
  10. +1 −1 src/core/composer/qgscomposernodesitem.cpp
  11. +3 −3 src/core/composer/qgscomposerscalebar.cpp
  12. +1 −1 src/core/effects/qgsimageoperation.cpp
  13. +1 −1 src/core/effects/qgsimageoperation.h
  14. +2 −2 src/core/expression/qgsexpressionfunction.cpp
  15. +1 −1 src/core/expression/qgsexpressionnodeimpl.cpp
  16. +1 −1 src/core/geometry/qgsellipse.cpp
  17. +4 −4 src/core/geometry/qgsgeometryutils.cpp
  18. +2 −2 src/core/geometry/qgsgeos.cpp
  19. +6 −6 src/core/geometry/qgslinestring.cpp
  20. +3 −3 src/core/pal/feature.cpp
  21. +1 −1 src/core/pal/pal.cpp
  22. +1 −1 src/core/pal/rtree.hpp
  23. +2 −2 src/core/qgis.h
  24. +1 −1 src/core/qgscoordinatetransform.cpp
  25. +1 −1 src/core/qgsfield.cpp
  26. +1 −1 src/core/qgshistogram.cpp
  27. +10 −10 src/core/qgspointxy.cpp
  28. +2 −2 src/core/qgspropertytransformer.cpp
  29. +2 −2 src/core/qgsscalecalculator.cpp
  30. +2 −2 src/core/qgsstatisticalsummary.cpp
  31. +1 −1 src/core/qgstextrenderer.cpp
  32. +1 −1 src/core/raster/qgsbrightnesscontrastfilter.cpp
  33. +1 −1 src/core/raster/qgscubicrasterresampler.cpp
  34. +1 −1 src/core/raster/qgshuesaturationfilter.cpp
  35. +1 −1 src/core/raster/qgsrasterchecker.cpp
  36. +1 −1 src/core/symbology/qgsfillsymbollayer.cpp
  37. +4 −4 src/core/symbology/qgsheatmaprenderer.cpp
  38. +1 −1 src/core/symbology/qgssymbollayerutils.cpp
  39. +1 −1 src/gui/editorwidgets/qgsdoublespinbox.cpp
  40. +6 −6 src/gui/qgsadvanceddigitizingdockwidget.cpp
  41. +1 −1 src/gui/qgscurveeditorwidget.cpp
  42. +4 −4 src/gui/qgsgradientcolorrampdialog.cpp
  43. +1 −1 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
  44. +2 −2 src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp
  45. +4 −4 src/plugins/georeferencer/qgsresidualplotitem.cpp
  46. +10 −10 src/plugins/grass/qgsgrassmapcalc.cpp
  47. +2 −2 src/providers/grass/qgis.g.info.c
  48. +1 −1 src/providers/wms/qgswmsprovider.cpp
  49. +1 −1 tests/bench/qgsbench.cpp
  50. +1 −1 tests/src/core/testqgsmapsettings.cpp
@@ -64,7 +64,7 @@ double CloughTocherInterpolator::calcBernsteinPoly( int n, int i, int j, int k,
return 0;
}

double result = MathUtils::faculty( n ) * qPow( u, i ) * qPow( v, j ) * qPow( w, k ) / ( MathUtils::faculty( i ) * MathUtils::faculty( j ) * MathUtils::faculty( k ) );
double result = MathUtils::faculty( n ) * std::pow( u, i ) * std::pow( v, j ) * std::pow( w, k ) / ( MathUtils::faculty( i ) * MathUtils::faculty( j ) * MathUtils::faculty( k ) );
return result;
}

@@ -107,7 +107,7 @@ double MathUtils::calcBernsteinPoly( int n, int i, double t )
return 0;
}

return lower( n, i ) * qPow( t, i ) * qPow( ( 1 - t ), ( n - i ) );
return lower( n, i ) * std::pow( t, i ) * std::pow( ( 1 - t ), ( n - i ) );
}

double MathUtils::cFDerBernsteinPoly( int n, int i, double t )
@@ -50,7 +50,7 @@ int QgsIDWInterpolator::interpolatePoint( double x, double y, double &result )
result = vertex_it.z;
return 0;
}
currentWeight = 1 / ( pow( distance, mDistanceCoefficient ) );
currentWeight = 1 / ( std::pow( distance, mDistanceCoefficient ) );
sumCounter += ( currentWeight * vertex_it.z );
sumDenominator += currentWeight;
}
@@ -181,7 +181,7 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::addFeature( const
double pixelCentroidX = ( xPosition + xp + 0.5 ) * mPixelSize + mBounds.xMinimum();
double pixelCentroidY = ( yPosition + yp + 0.5 ) * mPixelSize + mBounds.yMinimum();

double distance = sqrt( pow( pixelCentroidX - ( *pointIt ).x(), 2.0 ) + pow( pixelCentroidY - ( *pointIt ).y(), 2.0 ) );
double distance = sqrt( std::pow( pixelCentroidX - ( *pointIt ).x(), 2.0 ) + std::pow( pixelCentroidY - ( *pointIt ).y(), 2.0 ) );

// is pixel outside search bandwidth of feature?
if ( distance > radius )
@@ -324,13 +324,13 @@ double QgsKernelDensityEstimation::quarticKernel( const double distance, const d
case OutputScaled:
{
// Normalizing constant
double k = 116. / ( 5. * M_PI * pow( bandwidth, 2 ) );
double k = 116. / ( 5. * M_PI * std::pow( bandwidth, 2 ) );

// Derived from Wand and Jones (1995), p. 175
return k * ( 15. / 16. ) * pow( 1. - pow( distance / bandwidth, 2 ), 2 );
return k * ( 15. / 16. ) * std::pow( 1. - std::pow( distance / bandwidth, 2 ), 2 );
}
case OutputRaw:
return pow( 1. - pow( distance / bandwidth, 2 ), 2 );
return pow( 1. - std::pow( distance / bandwidth, 2 ), 2 );
}
return 0.0; //no, seriously, I told you NO WARNINGS!
}
@@ -342,13 +342,13 @@ double QgsKernelDensityEstimation::triweightKernel( const double distance, const
case OutputScaled:
{
// Normalizing constant
double k = 128. / ( 35. * M_PI * pow( bandwidth, 2 ) );
double k = 128. / ( 35. * M_PI * std::pow( bandwidth, 2 ) );

// Derived from Wand and Jones (1995), p. 175
return k * ( 35. / 32. ) * pow( 1. - pow( distance / bandwidth, 2 ), 3 );
return k * ( 35. / 32. ) * std::pow( 1. - std::pow( distance / bandwidth, 2 ), 3 );
}
case OutputRaw:
return pow( 1. - pow( distance / bandwidth, 2 ), 3 );
return pow( 1. - std::pow( distance / bandwidth, 2 ), 3 );
}
return 0.0; // this is getting ridiculous... don't you ever listen to a word I say?
}
@@ -360,13 +360,13 @@ double QgsKernelDensityEstimation::epanechnikovKernel( const double distance, co
case OutputScaled:
{
// Normalizing constant
double k = 8. / ( 3. * M_PI * pow( bandwidth, 2 ) );
double k = 8. / ( 3. * M_PI * std::pow( bandwidth, 2 ) );

// Derived from Wand and Jones (1995), p. 175
return k * ( 3. / 4. ) * ( 1. - pow( distance / bandwidth, 2 ) );
return k * ( 3. / 4. ) * ( 1. - std::pow( distance / bandwidth, 2 ) );
}
case OutputRaw:
return ( 1. - pow( distance / bandwidth, 2 ) );
return ( 1. - std::pow( distance / bandwidth, 2 ) );
}

return 0.0; // la la la i'm not listening
@@ -383,7 +383,7 @@ double QgsKernelDensityEstimation::triangularKernel( const double distance, cons

if ( mDecay >= 0 )
{
double k = 3. / ( ( 1. + 2. * mDecay ) * M_PI * pow( bandwidth, 2 ) );
double k = 3. / ( ( 1. + 2. * mDecay ) * M_PI * std::pow( bandwidth, 2 ) );

// Derived from Wand and Jones (1995), p. 175 (with addition of decay parameter)
return k * ( 1. - ( 1. - mDecay ) * ( distance / bandwidth ) );
@@ -292,7 +292,7 @@ double QgsRasterMatrix::calculateTwoArgumentOp( TwoArgOperator op, double arg1,
}
else
{
return qPow( arg1, arg2 );
return pow( arg1, arg2 );
}
case opEQ:
return ( arg1 == arg2 ? 1.0 : 0.0 );
@@ -309,7 +309,7 @@ int QgsZonalStatistics::calculateStatistics( QgsFeedback *feedback )
double variance = sumSquared / featureStats.values.count();
if ( mStatistics & QgsZonalStatistics::StDev )
{
double stdev = qPow( variance, 0.5 );
double stdev = std::pow( variance, 0.5 );
changeAttributeMap.insert( stdevIndex, QVariant( stdev ) );
}
if ( mStatistics & QgsZonalStatistics::Variance )
@@ -787,7 +787,7 @@ bool QgsDecorationGrid::getIntervalFromExtent( double *values, bool useXAxis )
if ( !qgsDoubleNear( interval, 0.0 ) )
{
double interval2 = 0;
int factor = pow( 10, floor( log10( interval ) ) );
int factor = std::pow( 10, floor( log10( interval ) ) );
if ( factor != 0 )
{
interval2 = std::round( interval / factor ) * factor;
@@ -163,7 +163,7 @@ void QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRender
// snap to integer < 10 times power of 10
if ( mSnapping )
{
double scaler = pow( 10.0, myPowerOf10 );
double scaler = std::pow( 10.0, myPowerOf10 );
myActualSize = std::round( myActualSize / scaler ) * scaler;
myScaleBarWidth = myActualSize / myMapUnitsPerPixelDouble;
}
@@ -1445,7 +1445,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr
{
QString hemisphere;

double coordRounded = std::round( value * pow( 10.0, mGridAnnotationPrecision ) ) / pow( 10.0, mGridAnnotationPrecision );
double coordRounded = std::round( value * std::pow( 10.0, mGridAnnotationPrecision ) ) / std::pow( 10.0, mGridAnnotationPrecision );
if ( coord == QgsComposerMapGrid::Longitude )
{
//don't use E/W suffixes if ambiguous (e.g., 180 degrees)
@@ -50,7 +50,7 @@ QgsComposerNodesItem::QgsComposerNodesItem( const QString &tagName,
double QgsComposerNodesItem::computeDistance( QPointF pt1,
QPointF pt2 ) const
{
return sqrt( pow( pt1.x() - pt2.x(), 2 ) + pow( pt1.y() - pt2.y(), 2 ) );
return sqrt( std::pow( pt1.x() - pt2.x(), 2 ) + std::pow( pt1.y() - pt2.y(), 2 ) );
}

bool QgsComposerNodesItem::addNode( QPointF pt,
@@ -262,14 +262,14 @@ void QgsComposerScaleBar::refreshDataDefinedProperty( const QgsComposerObject::D
// nextNiceNumber(4573.23, d) = 5000 (d=1) -> 4600 (d=10) -> 4580 (d=100) -> 4574 (d=1000) -> etc
inline double nextNiceNumber( double a, double d = 1 )
{
double s = qPow( 10.0, floor( log10( a ) ) ) / d;
double s = std::pow( 10.0, floor( log10( a ) ) ) / d;
return ceil( a / s ) * s;
}

// prevNiceNumber(4573.23, d) = 4000 (d=1) -> 4500 (d=10) -> 4570 (d=100) -> 4573 (d=1000) -> etc
inline double prevNiceNumber( double a, double d = 1 )
{
double s = qPow( 10.0, floor( log10( a ) ) ) / d;
double s = std::pow( 10.0, floor( log10( a ) ) ) / d;
return floor( a / s ) * s;
}

@@ -474,7 +474,7 @@ void QgsComposerScaleBar::applyDefaultSize( QgsUnitTypes::DistanceUnit u )

double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier;
int segmentMagnitude = floor( log10( segmentWidth ) );
double unitsPerSegment = upperMagnitudeMultiplier * ( qPow( 10.0, segmentMagnitude ) );
double unitsPerSegment = upperMagnitudeMultiplier * ( std::pow( 10.0, segmentMagnitude ) );
double multiplier = floor( ( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5;

if ( multiplier > 0 )
@@ -290,7 +290,7 @@ void QgsImageOperation::HueSaturationPixelOperation::operator()( QRgb &rgb, cons
{
// Raising the saturation. Use a saturation curve to prevent
// clipping at maximum saturation with ugly results.
s = qMin( static_cast< int >( 255. * ( 1 - qPow( 1 - ( s / 255. ), qPow( mSaturation, 2 ) ) ) ), 255 );
s = qMin( static_cast< int >( 255. * ( 1 - std::pow( 1 - ( s / 255. ), std::pow( mSaturation, 2 ) ) ) ), 255 );
}

if ( mColorize )
@@ -375,7 +375,7 @@ class CORE_EXPORT QgsImageOperation
, mSpread( spread )
, mProperties( properties )
{
mSpreadSquared = qPow( mSpread, 2.0 );
mSpreadSquared = std::pow( mSpread, 2.0 );
}

void operator()( QRgb &rgb, const int x, const int y );
@@ -402,7 +402,7 @@ static QVariant fcnExpScale( const QVariantList &values, const QgsExpressionCont
}

// Return exponentially scaled value
return QVariant( ( ( rangeMax - rangeMin ) / pow( domainMax - domainMin, exponent ) ) * pow( val - domainMin, exponent ) + rangeMin );
return QVariant( ( ( rangeMax - rangeMin ) / std::pow( domainMax - domainMin, exponent ) ) * std::pow( val - domainMin, exponent ) + rangeMin );
}

static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
@@ -2883,7 +2883,7 @@ static QVariant fcnRound( const QVariantList &values, const QgsExpressionContext
if ( values.length() == 2 && values.at( 1 ).toInt() != 0 )
{
double number = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
double scaler = pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
double scaler = std::pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
return QVariant( std::round( number * scaler ) / scaler );
}

@@ -279,7 +279,7 @@ QVariant QgsExpressionNodeBinaryOperator::evalNode( QgsExpression *parent, const
ENSURE_NO_EVAL_ERROR;
double fR = QgsExpressionUtils::getDoubleValue( vR, parent );
ENSURE_NO_EVAL_ERROR;
return QVariant( pow( fL, fR ) );
return QVariant( std::pow( fL, fR ) );
}

case boAnd:
@@ -64,7 +64,7 @@ QgsEllipse QgsEllipse::fromFoci( const QgsPoint &pt1, const QgsPoint &pt2, const
QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 );

double axis_a = dist / 2.0;
double axis_b = sqrt( pow( axis_a, 2.0 ) - pow( dist_p1p2 / 2.0, 2.0 ) );
double axis_b = sqrt( std::pow( axis_a, 2.0 ) - std::pow( dist_p1p2 / 2.0, 2.0 ) );

return QgsEllipse( center, axis_a, axis_b, azimuth );
}
@@ -451,7 +451,7 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &
{
centerX = ( pt1.x() + pt2.x() ) / 2.0;
centerY = ( pt1.y() + pt2.y() ) / 2.0;
radius = sqrt( pow( centerX - pt1.x(), 2.0 ) + pow( centerY - pt1.y(), 2.0 ) );
radius = sqrt( std::pow( centerX - pt1.x(), 2.0 ) + std::pow( centerY - pt1.y(), 2.0 ) );
return;
}

@@ -461,8 +461,8 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &
dx31 = pt3.x() - pt1.x();
dy31 = pt3.y() - pt1.y();

h21 = pow( dx21, 2.0 ) + pow( dy21, 2.0 );
h31 = pow( dx31, 2.0 ) + pow( dy31, 2.0 );
h21 = std::pow( dx21, 2.0 ) + std::pow( dy21, 2.0 );
h31 = std::pow( dx31, 2.0 ) + std::pow( dy31, 2.0 );

// 2*Cross product, d<0 means clockwise and d>0 counterclockwise sweeping angle
d = 2 * ( dx21 * dy31 - dx31 * dy21 );
@@ -477,7 +477,7 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &
// Calculate centroid coordinates and radius
centerX = pt1.x() + ( h21 * dy31 - h31 * dy21 ) / d;
centerY = pt1.y() - ( h21 * dx31 - h31 * dx21 ) / d;
radius = sqrt( pow( centerX - pt1.x(), 2.0 ) + pow( centerY - pt1.y(), 2.0 ) );
radius = sqrt( std::pow( centerX - pt1.x(), 2.0 ) + std::pow( centerY - pt1.y(), 2.0 ) );
}

bool QgsGeometryUtils::circleClockwise( double angle1, double angle2, double angle3 )
@@ -2635,7 +2635,7 @@ int QgsGeos::lineContainedInLine( const GEOSGeometry *line1, const GEOSGeometry
return -1;
}

double bufferDistance = pow( 10.0L, geomDigits( line2 ) - 11 );
double bufferDistance = std::pow( 10.0L, geomDigits( line2 ) - 11 );

GEOSGeometry *bufferGeom = GEOSBuffer_r( geosinit.ctxt, line2, bufferDistance, DEFAULT_QUADRANT_SEGMENTS );
if ( !bufferGeom )
@@ -2665,7 +2665,7 @@ int QgsGeos::pointContainedInLine( const GEOSGeometry *point, const GEOSGeometry
if ( !point || !line )
return -1;

double bufferDistance = pow( 10.0L, geomDigits( line ) - 11 );
double bufferDistance = std::pow( 10.0L, geomDigits( line ) - 11 );

GEOSGeometry *lineBuffer = GEOSBuffer_r( geosinit.ctxt, line, bufferDistance, 8 );
if ( !lineBuffer )
@@ -679,8 +679,8 @@ void QgsLineString::extend( double startDistance, double endDistance )
// start of line
if ( startDistance > 0 )
{
double currentLen = sqrt( qPow( mX.at( 0 ) - mX.at( 1 ), 2 ) +
qPow( mY.at( 0 ) - mY.at( 1 ), 2 ) );
double currentLen = sqrt( std::pow( mX.at( 0 ) - mX.at( 1 ), 2 ) +
std::pow( mY.at( 0 ) - mY.at( 1 ), 2 ) );
double newLen = currentLen + startDistance;
mX[ 0 ] = mX.at( 1 ) + ( mX.at( 0 ) - mX.at( 1 ) ) / currentLen * newLen;
mY[ 0 ] = mY.at( 1 ) + ( mY.at( 0 ) - mY.at( 1 ) ) / currentLen * newLen;
@@ -689,8 +689,8 @@ void QgsLineString::extend( double startDistance, double endDistance )
if ( endDistance > 0 )
{
int last = mX.size() - 1;
double currentLen = sqrt( qPow( mX.at( last ) - mX.at( last - 1 ), 2 ) +
qPow( mY.at( last ) - mY.at( last - 1 ), 2 ) );
double currentLen = sqrt( std::pow( mX.at( last ) - mX.at( last - 1 ), 2 ) +
std::pow( mY.at( last ) - mY.at( last - 1 ), 2 ) );
double newLen = currentLen + endDistance;
mX[ last ] = mX.at( last - 1 ) + ( mX.at( last ) - mX.at( last - 1 ) ) / currentLen * newLen;
mY[ last ] = mY.at( last - 1 ) + ( mY.at( last ) - mY.at( last - 1 ) ) / currentLen * newLen;
@@ -916,8 +916,8 @@ QgsPoint QgsLineString::centroid() const
{
double currentX = mX.at( i );
double currentY = mY.at( i );
double segmentLength = sqrt( qPow( currentX - prevX, 2.0 ) +
qPow( currentY - prevY, 2.0 ) );
double segmentLength = sqrt( std::pow( currentX - prevX, 2.0 ) +
std::pow( currentY - prevY, 2.0 ) );
if ( qgsDoubleNear( segmentLength, 0.0 ) )
continue;

@@ -1161,7 +1161,7 @@ int FeaturePart::createCurvedCandidatesAlongLine( QList< LabelPosition * > &lPos
if ( i == 0 )
path_distances[i] = 0;
else
path_distances[i] = sqrt( pow( old_x - mapShape->x[i], 2 ) + pow( old_y - mapShape->y[i], 2 ) );
path_distances[i] = sqrt( std::pow( old_x - mapShape->x[i], 2 ) + std::pow( old_y - mapShape->y[i], 2 ) );
old_x = mapShape->x[i];
old_y = mapShape->y[i];

@@ -1808,13 +1808,13 @@ bool FeaturePart::nextCharPosition( double charWidth, double segment_length, Poi
dx = new_x - old_x;
dy = new_y - old_y;
}
while ( sqrt( pow( start_x - new_x, 2 ) + pow( start_y - new_y, 2 ) ) < charWidth ); // Distance from start_ to new_
while ( sqrt( std::pow( start_x - new_x, 2 ) + std::pow( start_y - new_y, 2 ) ) < charWidth ); // Distance from start_ to new_

// Calculate the position to place the end of the character on
GeomFunction::findLineCircleIntersection( start_x, start_y, charWidth, old_x, old_y, new_x, new_y, end_x, end_y );

// Need to calculate distance on the new segment
distance = sqrt( pow( old_x - end_x, 2 ) + pow( old_y - end_y, 2 ) );
distance = sqrt( std::pow( old_x - end_x, 2 ) + std::pow( old_y - end_y, 2 ) );
}
return true;
}
@@ -356,7 +356,7 @@ Problem *Pal::extract( double lambda_min, double phi_min, double lambda_max, dou
feat = fFeats->takeFirst();

prob->featStartId[i] = idlp;
prob->inactiveCost[i] = pow( 2, 10 - 10 * feat->priority );
prob->inactiveCost[i] = std::pow( 2, 10 - 10 * feat->priority );

switch ( feat->feature->getGeosType() )
{
@@ -1180,7 +1180,7 @@ namespace pal
}
else
{
return static_cast< ELEMTYPEREAL >( pow( radius, NUMDIMS ) * m_unitSphereVolume );
return static_cast< ELEMTYPEREAL >( std::pow( radius, NUMDIMS ) * m_unitSphereVolume );
}
}

@@ -236,7 +236,7 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
double br = frexp( b, &bexp );

return aexp == bexp &&
std::round( ar * pow( 10.0, significantDigits ) ) == std::round( br * pow( 10.0, significantDigits ) );
std::round( ar * std::pow( 10.0, significantDigits ) ) == std::round( br * std::pow( 10.0, significantDigits ) );
}

/**
@@ -246,7 +246,7 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
*/
inline double qgsRound( double number, double places )
{
int scaleFactor = pow( 10, places );
int scaleFactor = std::pow( 10, places );
return static_cast<double>( static_cast<qlonglong>( number * scaleFactor + 0.5 ) ) / scaleFactor;
}

@@ -352,7 +352,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r
// even with 1000 points it takes < 1ms
// TODO: how to effectively and precisely reproject bounding box?
const int nPoints = 1000;
double d = sqrt( ( rect.width() * rect.height() ) / pow( sqrt( static_cast< double >( nPoints ) ) - 1, 2.0 ) );
double d = sqrt( ( rect.width() * rect.height() ) / std::pow( sqrt( static_cast< double >( nPoints ) ) - 1, 2.0 ) );
int nXPoints = static_cast< int >( ceil( rect.width() / d ) ) + 1;
int nYPoints = static_cast< int >( ceil( rect.height() / d ) ) + 1;

@@ -268,7 +268,7 @@ bool QgsField::convertCompatible( QVariant &v ) const

if ( d->type == QVariant::Double && d->precision > 0 )
{
double s = qPow( 10, d->precision );
double s = std::pow( 10, d->precision );
double d = v.toDouble() * s;
v = QVariant( ( d < 0 ? ceil( d - 0.5 ) : floor( d + 0.5 ) ) / s );
return true;
@@ -65,7 +65,7 @@ bool QgsHistogram::setValues( const QgsVectorLayer *layer, const QString &fieldO
double QgsHistogram::optimalBinWidth() const
{
//Freedman-Diaconis rule
return 2.0 * mIQR * qPow( mValues.count(), -1 / 3.0 );
return 2.0 * mIQR * std::pow( mValues.count(), -1 / 3.0 );
}

int QgsHistogram::optimalNumberBins() const

0 comments on commit 031bf41

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