-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-Wfloat-equal produces compiler warning in Mapbox SDK #11898
Comments
Thanks for the report — I’m unsure if this warning represents a practical issue, as there’s some dispute about this tricky topic. As for how - (void)testCoordinateSpan {
MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(CLLocationCoordinate2DMake(38.9131982, -77.0325453144239),
CLLocationCoordinate2DMake(37.7757368, -122.4135302));
MGLCoordinateSpan span = MGLCoordinateBoundsGetCoordinateSpan(bounds);
MGLCoordinateSpan expectedSpan = MGLCoordinateSpanMake(-1.1374614, -45.3809848856);
// error: -[MGLGeometryTests testCoordinateSpan] : ((span.latitudeDelta) equal to (expectedSpan.latitudeDelta)) failed: ("-1.1374614") is not equal to ("-1.1374614")
// error: -[MGLGeometryTests testCoordinateSpan] : ((span.longitudeDelta) equal to (expectedSpan.longitudeDelta)) failed: ("-45.3809848856") is not equal to ("-45.3809848856")
expectedSpan = MGLCoordinateSpanMake(-1.1374613999999994, -45.380984885576098);
XCTAssertEqual(span.latitudeDelta, expectedSpan.latitudeDelta);
XCTAssertEqual(span.longitudeDelta, expectedSpan.longitudeDelta);
XCTAssertTrue(MGLCoordinateSpanEqualToCoordinateSpan(span, expectedSpan));
// ✅
} ... but I don’t think manual input is a use case we’ve ever seen — |
Some options:
/ref #6060 |
Regarding severity, for me this issue is rather low priority. For me it would have been helpful to find a hint about this (or other conflicting compiler flags) in the Mapbox docs. So, that I know that the Mapbox SDK is working properly and I don’t get the impression that the SDK version, I’m trying to build is "kaputt".
|
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Platform:
Mapbox SDK version:
Steps to trigger behavior
Treat Warnings as Errors
= YESxcconfig
setWARNING_CFLAGS = -Wfloat-equal
Expected behavior
No warning is produced, because float numbers are compared for equality as suggested by Apple (e.g. `fabs(...) & epsilon).
Actual behavior
Compiler warning is produced:
The text was updated successfully, but these errors were encountered: