-
Notifications
You must be signed in to change notification settings - Fork 229
fix: failing tests on macos in release mode #1470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -583,7 +583,7 @@ class geographic_cross_track | |
| } | ||
|
|
||
| if ( (meridian_not_crossing_pole || meridian_crossing_pole ) | ||
| && std::abs(lat1) > std::abs(lat2)) | ||
| && math::abs(lat1) > math::abs(lat2)) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually unrelated and was added for a test to run a geographic test also for boost multiprecision, to get the "real" trustable value. But in the end that was much more work than this only and is not continued. Separately we should add a PR replacing the 99 occurrences of std::abs by math::abs, and for sqrt and probably other functions similarly |
||
| { | ||
| #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK | ||
| std::cout << "Meridian segment not crossing pole" << std::endl; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,6 +189,20 @@ struct precise_cartesian : bg::strategies::detail::cartesian_base | |
| } | ||
| }; | ||
|
|
||
| // Tests cartesian area for ill-conditioned polygons whose coordinates | ||
| // span very different magnitudes. Three variants | ||
| // are compared on the same WKT input, and each isolates a different | ||
| // source of error: | ||
| // | ||
| // Two lossy steps can happen: | ||
| // | ||
| // - WKT -> double rounding. Literals like "0.20000000000000004" do not | ||
| // fit exactly in IEEE-754 double; some collapse onto the same bit | ||
| // pattern. Only avoided by parsing into MP. | ||
| // - Reassociation of (x1+x2)*(y1-y2) terms. For this polygon the huge | ||
| // terms nearly cancel, so the result of naive summation depends on | ||
| // the order chosen by the compiler under -O / vectorisation. | ||
| // Compensated summation removes that dependency | ||
| void test_accurate_sum_strategy() | ||
| { | ||
| typedef bg::model::point<double, 2, bg::cs::cartesian> point_type; | ||
|
|
@@ -221,27 +235,33 @@ void test_accurate_sum_strategy() | |
| bg::model::polygon<point_type> poly1; | ||
| bg::read_wkt(poly1_string, poly1); | ||
|
|
||
| BOOST_CHECK_CLOSE(bg::area(poly1), 0, 0.0001); | ||
| #if defined(BOOST_GEOMETRY_TEST_FLAKY) | ||
| BOOST_CHECK_CLOSE(bg::area(poly1), 5.9421121885698253e+28, 0.0001); | ||
| #endif | ||
| BOOST_CHECK_CLOSE(bg::area(poly1, precise_cartesian()), -0.315, 0.0001); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually both outcomes are wrong, assuming the Boost.MultiPrecision value is correct. Why it is detected here is that the outcome (of the first) for MacOs is different on |
||
|
|
||
| bg::model::polygon<mp_point_type> mp_poly1; | ||
| bg::read_wkt(poly1_string, mp_poly1); | ||
|
|
||
| BOOST_CHECK_CLOSE(bg::area(mp_poly1), 34720783012552.6, 0.0001); | ||
| BOOST_CHECK_CLOSE(bg::area(mp_poly1, precise_cartesian()), 34720783012552.6, 0.0001); | ||
|
|
||
| auto const poly2_string = "POLYGON((1.267650600228229e30 1.2676506002282291e30,\ | ||
| 0.8 0.8,0.2 0.2,0.1 0.1,1.267650600228229e30 1.2676506002282291e30))"; | ||
|
|
||
| bg::model::polygon<point_type> poly2; | ||
| bg::read_wkt(poly2_string, poly2); | ||
|
|
||
| BOOST_CHECK_CLOSE(bg::area(poly2), 0, 0.0001); | ||
| #if defined(BOOST_GEOMETRY_TEST_FLAKY) | ||
| BOOST_CHECK_CLOSE(bg::area(poly2), -5.9421121885698253e+28, 0.0001); | ||
| #endif | ||
| BOOST_CHECK_CLOSE(bg::area(poly2, precise_cartesian()), 0.315, 0.0001); | ||
|
|
||
| bg::model::polygon<mp_point_type> mp_poly2; | ||
| bg::read_wkt(poly2_string, mp_poly2); | ||
|
|
||
| BOOST_CHECK_CLOSE(bg::area(mp_poly2), 35000000000000, 0.0001); | ||
| BOOST_CHECK_CLOSE(bg::area(mp_poly2, precise_cartesian()), 35000000000000, 0.0001); | ||
| } | ||
|
|
||
| void test_dynamic() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could introduce a pair
math::acos(similar tomath::sqrt) andmath::acos_clamped, for these kind of situations. Same forasin.But I didn't want to do this in this PR