Skip to content

Commit 47e7a10

Browse files
committedJun 16, 2018
DBL_EPSILON -> numeric_limits
1 parent eabd5c3 commit 47e7a10

13 files changed

+77
-77
lines changed
 

‎python/core/auto_generated/qgis.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Returns a string representation of a double
100100
:param precision: number of decimal places to retain
101101
%End
102102

103-
bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON );
103+
bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() );
104104
%Docstring
105105
Compare two doubles (but allow some difference)
106106

‎src/core/geometry/qgsgeos.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,17 +310,17 @@ void QgsGeos::subdivideRecursive( const GEOSGeometry *currentPart, int maxNodes,
310310

311311
if ( height <= 0 )
312312
{
313-
halfClipRect1.setYMinimum( halfClipRect1.yMinimum() - DBL_EPSILON );
314-
halfClipRect2.setYMinimum( halfClipRect2.yMinimum() - DBL_EPSILON );
315-
halfClipRect1.setYMaximum( halfClipRect1.yMaximum() + DBL_EPSILON );
316-
halfClipRect2.setYMaximum( halfClipRect2.yMaximum() + DBL_EPSILON );
313+
halfClipRect1.setYMinimum( halfClipRect1.yMinimum() - std::numeric_limits<double>::epsilon() );
314+
halfClipRect2.setYMinimum( halfClipRect2.yMinimum() - std::numeric_limits<double>::epsilon() );
315+
halfClipRect1.setYMaximum( halfClipRect1.yMaximum() + std::numeric_limits<double>::epsilon() );
316+
halfClipRect2.setYMaximum( halfClipRect2.yMaximum() + std::numeric_limits<double>::epsilon() );
317317
}
318318
if ( width <= 0 )
319319
{
320-
halfClipRect1.setXMinimum( halfClipRect1.xMinimum() - DBL_EPSILON );
321-
halfClipRect2.setXMinimum( halfClipRect2.xMinimum() - DBL_EPSILON );
322-
halfClipRect1.setXMaximum( halfClipRect1.xMaximum() + DBL_EPSILON );
323-
halfClipRect2.setXMaximum( halfClipRect2.xMaximum() + DBL_EPSILON );
320+
halfClipRect1.setXMinimum( halfClipRect1.xMinimum() - std::numeric_limits<double>::epsilon() );
321+
halfClipRect2.setXMinimum( halfClipRect2.xMinimum() - std::numeric_limits<double>::epsilon() );
322+
halfClipRect1.setXMaximum( halfClipRect1.xMaximum() + std::numeric_limits<double>::epsilon() );
323+
halfClipRect2.setXMaximum( halfClipRect2.xMaximum() + std::numeric_limits<double>::epsilon() );
324324
}
325325

326326
geos::unique_ptr clipPart1( GEOSClipByRect_r( geosinit.ctxt, currentPart, halfClipRect1.xMinimum(), halfClipRect1.yMinimum(), halfClipRect1.xMaximum(), halfClipRect1.yMaximum() ) );

‎src/core/geometry/qgspolygon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ double QgsPolygon::pointDistanceToBoundary( double x, double y ) const
260260
( x < ( bX - aX ) * ( y - aY ) / ( bY - aY ) + aX ) )
261261
inside = !inside;
262262

263-
minimumDistance = std::min( minimumDistance, QgsGeometryUtils::sqrDistToLine( x, y, aX, aY, bX, bY, minDistX, minDistY, 4 * DBL_EPSILON ) );
263+
minimumDistance = std::min( minimumDistance, QgsGeometryUtils::sqrDistToLine( x, y, aX, aY, bX, bY, minDistX, minDistY, 4 * std::numeric_limits<double>::epsilon() ) );
264264
}
265265
}
266266

‎src/core/qgis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ inline QString qgsDoubleToString( double a, int precision = 17 )
248248
* \param b second double
249249
* \param epsilon maximum difference allowable between doubles
250250
*/
251-
inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
251+
inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() )
252252
{
253253
const double diff = a - b;
254254
return diff > -epsilon && diff <= epsilon;

‎tests/src/core/testqgsdistancearea.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ void TestQgsDistanceArea::collections()
234234
double result = myDa.measureLength( lines );
235235
QGSCOMPARENEAR( result, 12006159, 1 );
236236
result = myDa.measureArea( lines );
237-
QGSCOMPARENEAR( result, 0, 4 * DBL_EPSILON );
237+
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );
238238

239239
//collection of polygons
240240
QgsGeometry polys( QgsGeometryFactory::geomFromWkt( QStringLiteral( "GeometryCollection( Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ).release() );
241241
result = myDa.measureArea( polys );
242242
QGSCOMPARENEAR( result, 670434859475LL, 1 );
243243
result = myDa.measureLength( polys );
244-
QGSCOMPARENEAR( result, 0, 4 * DBL_EPSILON );
244+
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );
245245

246246
//mixed collection
247247
QgsGeometry mixed( QgsGeometryFactory::geomFromWkt( QStringLiteral( "GeometryCollection( LineString(0 36.53, 5.76 -48.16), LineString(0 25.54, 24.20 36.70), Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ).release() );

‎tests/src/core/testqgsgeometry.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,8 @@ void TestQgsGeometry::point()
681681
//toQPointF
682682
QgsPoint p11a( 5.0, 9.0 );
683683
QPointF result = p11a.toQPointF();
684-
QGSCOMPARENEAR( result.x(), 5.0, 4 * DBL_EPSILON );
685-
QGSCOMPARENEAR( result.y(), 9.0, 4 * DBL_EPSILON );
684+
QGSCOMPARENEAR( result.x(), 5.0, 4 * std::numeric_limits<double>::epsilon() );
685+
QGSCOMPARENEAR( result.y(), 9.0, 4 * std::numeric_limits<double>::epsilon() );
686686

687687
//to/from WKB
688688
QgsPoint p12( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 );
@@ -4199,26 +4199,26 @@ void TestQgsGeometry::lineString()
41994199
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) );
42004200
QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v ) < 0 );
42014201
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) );
4202-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2.0, 4 * DBL_EPSILON );
4202+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2.0, 4 * std::numeric_limits<double>::epsilon() );
42034203
QCOMPARE( p, QgsPoint( 5, 10 ) );
42044204
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42054205
QCOMPARE( leftOf, -1 );
4206-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
4206+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.0, 4 * std::numeric_limits<double>::epsilon() );
42074207
QCOMPARE( p, QgsPoint( 8, 10 ) );
42084208
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42094209
QCOMPARE( leftOf, -1 );
4210-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
4210+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf ), 1.0, 4 * std::numeric_limits<double>::epsilon() );
42114211
QCOMPARE( p, QgsPoint( 8, 10 ) );
42124212
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42134213
QCOMPARE( leftOf, 1 );
4214-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf ), 2.0, 4 * DBL_EPSILON );
4214+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf ), 2.0, 4 * std::numeric_limits<double>::epsilon() );
42154215
QCOMPARE( p, QgsPoint( 10, 10 ) );
42164216
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42174217
QCOMPARE( leftOf, 1 );
42184218
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 )
42194219
<< QgsPoint( 10, 10 )
42204220
<< QgsPoint( 10, 15 ) );
4221-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
4221+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf ), 1.0, 4 * std::numeric_limits<double>::epsilon() );
42224222
QCOMPARE( p, QgsPoint( 10, 12 ) );
42234223
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
42244224
QCOMPARE( leftOf, 1 );
@@ -4227,7 +4227,7 @@ void TestQgsGeometry::lineString()
42274227
<< QgsPoint( 6, 4 )
42284228
<< QgsPoint( 4, 4 )
42294229
<< QgsPoint( 5, 5 ) );
4230-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * DBL_EPSILON );
4230+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * std::numeric_limits<double>::epsilon() );
42314231
QCOMPARE( p, QgsPoint( 4, 4 ) );
42324232
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
42334233
QCOMPARE( leftOf, -1 );
@@ -4236,7 +4236,7 @@ void TestQgsGeometry::lineString()
42364236
<< QgsPoint( 4, 4 )
42374237
<< QgsPoint( 6, 4 )
42384238
<< QgsPoint( 5, 5 ) );
4239-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * DBL_EPSILON );
4239+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * std::numeric_limits<double>::epsilon() );
42404240
QCOMPARE( p, QgsPoint( 4, 4 ) );
42414241
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42424242
QCOMPARE( leftOf, 1 );
@@ -4245,7 +4245,7 @@ void TestQgsGeometry::lineString()
42454245
<< QgsPoint( 6, 4 )
42464246
<< QgsPoint( 4, 4 )
42474247
<< QgsPoint( 5, 5 ) );
4248-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * DBL_EPSILON );
4248+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * std::numeric_limits<double>::epsilon() );
42494249
QCOMPARE( p, QgsPoint( 4, 4 ) );
42504250
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
42514251
QCOMPARE( leftOf, -1 );
@@ -4254,7 +4254,7 @@ void TestQgsGeometry::lineString()
42544254
<< QgsPoint( 4, 4 )
42554255
<< QgsPoint( 6, 4 )
42564256
<< QgsPoint( 5, 5 ) );
4257-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * DBL_EPSILON );
4257+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * std::numeric_limits<double>::epsilon() );
42584258
QCOMPARE( p, QgsPoint( 4, 4 ) );
42594259
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42604260
QCOMPARE( leftOf, 1 );
@@ -4263,7 +4263,7 @@ void TestQgsGeometry::lineString()
42634263
<< QgsPoint( 1, 4 )
42644264
<< QgsPoint( 2, 2 )
42654265
<< QgsPoint( 1, 1 ) );
4266-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * DBL_EPSILON );
4266+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * std::numeric_limits<double>::epsilon() );
42674267
QCOMPARE( p, QgsPoint( 1, 1 ) );
42684268
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42694269
QCOMPARE( leftOf, -1 );
@@ -4272,7 +4272,7 @@ void TestQgsGeometry::lineString()
42724272
<< QgsPoint( 2, 2 )
42734273
<< QgsPoint( 1, 4 )
42744274
<< QgsPoint( 1, 1 ) );
4275-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * DBL_EPSILON );
4275+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * std::numeric_limits<double>::epsilon() );
42764276
QCOMPARE( p, QgsPoint( 1, 1 ) );
42774277
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
42784278
QCOMPARE( leftOf, 1 );
@@ -4287,13 +4287,13 @@ void TestQgsGeometry::lineString()
42874287
QCOMPARE( area, 1.0 );
42884288
l36.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) );
42894289
l36.sumUpArea( area );
4290-
QGSCOMPARENEAR( area, -24, 4 * DBL_EPSILON );
4290+
QGSCOMPARENEAR( area, -24, 4 * std::numeric_limits<double>::epsilon() );
42914291
l36.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 2, 0 ) << QgsPoint( 2, 2 ) );
42924292
l36.sumUpArea( area );
4293-
QGSCOMPARENEAR( area, -22, 4 * DBL_EPSILON );
4293+
QGSCOMPARENEAR( area, -22, 4 * std::numeric_limits<double>::epsilon() );
42944294
l36.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 2, 0 ) << QgsPoint( 2, 2 ) << QgsPoint( 0, 2 ) );
42954295
l36.sumUpArea( area );
4296-
QGSCOMPARENEAR( area, -18, 4 * DBL_EPSILON );
4296+
QGSCOMPARENEAR( area, -18, 4 * std::numeric_limits<double>::epsilon() );
42974297

42984298
//boundingBox - test that bounding box is updated after every modification to the line string
42994299
QgsLineString l37;
@@ -4342,8 +4342,8 @@ void TestQgsGeometry::lineString()
43424342
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 1.5708, 0.0001 );
43434343
( void )l38.vertexAngle( QgsVertexId( 0, 0, 2 ) ); //no crash
43444344
l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 1 ) );
4345-
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 0.0, 4 * DBL_EPSILON );
4346-
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 0.0, 4 * DBL_EPSILON );
4345+
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 0.0, 4 * std::numeric_limits<double>::epsilon() );
4346+
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 0.0, 4 * std::numeric_limits<double>::epsilon() );
43474347
l38.setPoints( QgsPointSequence() << QgsPoint( 1, 0 ) << QgsPoint( 0, 0 ) );
43484348
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 4.71239, 0.0001 );
43494349
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 4.71239, 0.0001 );
@@ -10927,7 +10927,7 @@ void TestQgsGeometry::compoundCurve()
1092710927
<< QgsPoint( 1, 1 ) );
1092810928
double lsArea = 0.0;
1092910929
ls.sumUpArea( lsArea );
10930-
QGSCOMPARENEAR( ccArea, lsArea, 4 * DBL_EPSILON );
10930+
QGSCOMPARENEAR( ccArea, lsArea, 4 * std::numeric_limits<double>::epsilon() );
1093110931

1093210932

1093310933
//addVertex

‎tests/src/core/testqgsgeometryimport.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ void TestQgsGeometryImport::pointWkt()
8585
QCOMPARE( geom.wkbType(), QgsWkbTypes::Point );
8686
QgsPointXY point = geom.asPoint();
8787

88-
QGSCOMPARENEAR( point.x(), x, 4 * DBL_EPSILON );
89-
QGSCOMPARENEAR( point.y(), y, 4 * DBL_EPSILON );
88+
QGSCOMPARENEAR( point.x(), x, 4 * std::numeric_limits<double>::epsilon() );
89+
QGSCOMPARENEAR( point.y(), y, 4 * std::numeric_limits<double>::epsilon() );
9090
}
9191

9292
void TestQgsGeometryImport::pointWkb_data()
@@ -113,8 +113,8 @@ void TestQgsGeometryImport::pointWkb()
113113
QgsPointXY point = geom.asPoint();
114114

115115
QCOMPARE( geom.wkbType(), QgsWkbTypes::Point );
116-
QGSCOMPARENEAR( point.x(), x, 4 * DBL_EPSILON );
117-
QGSCOMPARENEAR( point.y(), y, 4 * DBL_EPSILON );
116+
QGSCOMPARENEAR( point.x(), x, 4 * std::numeric_limits<double>::epsilon() );
117+
QGSCOMPARENEAR( point.y(), y, 4 * std::numeric_limits<double>::epsilon() );
118118
}
119119

120120
void TestQgsGeometryImport::pointGeos_data()
@@ -140,8 +140,8 @@ void TestQgsGeometryImport::pointGeos()
140140

141141
QgsPointXY geomPt = geom.asPoint();
142142

143-
QGSCOMPARENEAR( x, geomPt.x(), 4 * DBL_EPSILON );
144-
QGSCOMPARENEAR( y, geomPt.y(), 4 * DBL_EPSILON );
143+
QGSCOMPARENEAR( x, geomPt.x(), 4 * std::numeric_limits<double>::epsilon() );
144+
QGSCOMPARENEAR( y, geomPt.y(), 4 * std::numeric_limits<double>::epsilon() );
145145
}
146146

147147
void TestQgsGeometryImport::linestringWkt_data()

‎tests/src/core/testqgsgeometryutils.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ void TestQgsGeometryUtils::testSegmentMidPoint()
211211
midPoint, radius, left );
212212

213213
QVERIFY( ok );
214-
QGSCOMPARENEAR( midPoint.x(), expectedX, 4 * DBL_EPSILON );
215-
QGSCOMPARENEAR( midPoint.y(), expectedY, 4 * DBL_EPSILON );
214+
QGSCOMPARENEAR( midPoint.x(), expectedX, 4 * std::numeric_limits<double>::epsilon() );
215+
QGSCOMPARENEAR( midPoint.y(), expectedY, 4 * std::numeric_limits<double>::epsilon() );
216216
}
217217

218218
void TestQgsGeometryUtils::testSegmentMidPointCenter()
@@ -266,7 +266,7 @@ void TestQgsGeometryUtils::testCircleLength()
266266
QFETCH( double, y3 );
267267
QFETCH( double, expected );
268268

269-
QGSCOMPARENEAR( expected, QgsGeometryUtils::circleLength( x1, y1, x2, y2, x3, y3 ), 4 * DBL_EPSILON );
269+
QGSCOMPARENEAR( expected, QgsGeometryUtils::circleLength( x1, y1, x2, y2, x3, y3 ), 4 * std::numeric_limits<double>::epsilon() );
270270
}
271271

272272
void TestQgsGeometryUtils::testNormalizedAngle_data()
@@ -323,7 +323,7 @@ void TestQgsGeometryUtils::testLineAngle()
323323

324324
double lineAngle = QgsGeometryUtils::lineAngle( x1, y1, x2, y2 ) * 180 / M_PI;
325325
if ( expected > -99999 )
326-
QGSCOMPARENEAR( lineAngle, expected, 4 * DBL_EPSILON );
326+
QGSCOMPARENEAR( lineAngle, expected, 4 * std::numeric_limits<double>::epsilon() );
327327
}
328328

329329
void TestQgsGeometryUtils::testLinePerpendicularAngle_data()
@@ -530,9 +530,9 @@ void TestQgsGeometryUtils::testCircleCenterRadius()
530530

531531
double radius, centerX, centerY;
532532
QgsGeometryUtils::circleCenterRadius( QgsPoint( x1, y1 ), QgsPoint( x2, y2 ), QgsPoint( x3, y3 ), radius, centerX, centerY );
533-
QGSCOMPARENEAR( expectedRadius, radius, 4 * DBL_EPSILON );
534-
QGSCOMPARENEAR( expectedCenterX, centerX, 4 * DBL_EPSILON );
535-
QGSCOMPARENEAR( expectedCenterY, centerY, 4 * DBL_EPSILON );
533+
QGSCOMPARENEAR( expectedRadius, radius, 4 * std::numeric_limits<double>::epsilon() );
534+
QGSCOMPARENEAR( expectedCenterX, centerX, 4 * std::numeric_limits<double>::epsilon() );
535+
QGSCOMPARENEAR( expectedCenterY, centerY, 4 * std::numeric_limits<double>::epsilon() );
536536
}
537537

538538
//QgsGeometryUtils::sqrDistToLine

‎tests/src/core/testqgslayout.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,9 @@ void TestQgsLayout::georeference()
841841
t = exporter.computeGeoTransform( map );
842842
QGSCOMPARENEAR( t[0], 1925.0, 1.0 );
843843
QGSCOMPARENEAR( t[1], 0.211719, 0.0001 );
844-
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
844+
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
845845
QGSCOMPARENEAR( t[3], 3050, 1 );
846-
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
846+
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
847847
QGSCOMPARENEAR( t[5], -0.211694, 0.0001 );
848848
t.reset();
849849

@@ -852,29 +852,29 @@ void TestQgsLayout::georeference()
852852
t = exporter.computeGeoTransform();
853853
QGSCOMPARENEAR( t[0], 1925.0, 1.0 );
854854
QGSCOMPARENEAR( t[1], 0.211719, 0.0001 );
855-
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
855+
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
856856
QGSCOMPARENEAR( t[3], 3050, 1 );
857-
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
857+
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
858858
QGSCOMPARENEAR( t[5], -0.211694, 0.0001 );
859859
t.reset();
860860

861861
// specify extent
862862
t = exporter.computeGeoTransform( map, QRectF( 70, 100, 50, 60 ) );
863863
QGSCOMPARENEAR( t[0], 2100.0, 1.0 );
864864
QGSCOMPARENEAR( t[1], 0.211864, 0.0001 );
865-
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
865+
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
866866
QGSCOMPARENEAR( t[3], 2800, 1 );
867-
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
867+
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
868868
QGSCOMPARENEAR( t[5], -0.211864, 0.0001 );
869869
t.reset();
870870

871871
// specify dpi
872872
t = exporter.computeGeoTransform( map, QRectF(), 75 );
873873
QGSCOMPARENEAR( t[0], 1925.0, 1 );
874874
QGSCOMPARENEAR( t[1], 0.847603, 0.0001 );
875-
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
875+
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
876876
QGSCOMPARENEAR( t[3], 3050.0, 1 );
877-
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
877+
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
878878
QGSCOMPARENEAR( t[5], -0.846774, 0.0001 );
879879
t.reset();
880880

0 commit comments

Comments
 (0)
Please sign in to comment.