From: Paul RASCLE Date: Mon, 20 May 2019 07:37:50 +0000 (+0200) Subject: replace abs by fabs for doubles X-Git-Tag: SH_V2_2_0~99^2~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb7adc780896badd7210655f3aa8cf15e228bfbe;p=modules%2Fhydro.git replace abs by fabs for doubles --- diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index 54c418ac..fb8a61ad 100644 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -528,29 +528,29 @@ bool convertEdgesToSections( const TopoDS_Edge& } else // old section closed: check if we use first or last points... { - if((pmin < pmax) && ((std::abs(pmin - pfirst)> 1.e-3) && (std::abs(pmax - plast) >1.e-3))) // internal points forward + if((pmin < pmax) && ((std::fabs(pmin - pfirst)> 1.e-3) && (std::fabs(pmax - plast) >1.e-3))) // internal points forward forward = true; - else if ((pmin > pmax) && ((std::abs(pmin - plast)> 1.e-3) && (std::abs(pmax - pfirst) >1.e-3))) // internal points reverse + else if ((pmin > pmax) && ((std::fabs(pmin - plast)> 1.e-3) && (std::fabs(pmax - pfirst) >1.e-3))) // internal points reverse { pmin = p[1]; pmax = p[0]; forward = false; } - else if ((std::abs(pmin - plast) <1.e-3) && (p[2] < pmax)) // forward, replace pmin par pfirst + else if ((std::fabs(pmin - plast) <1.e-3) && (p[2] < pmax)) // forward, replace pmin par pfirst pmin = pfirst; - else if ((std::abs(pmin - plast) <1.e-3) && (p[2] > pmax)) // reverse + else if ((std::fabs(pmin - plast) <1.e-3) && (p[2] > pmax)) // reverse { pmin = p[1]; pmax = p[0]; forward = false; } - else if ((std::abs(pmax - pfirst) <1.e-3) && (p[2] < pmin)) // reverse + else if ((std::fabs(pmax - pfirst) <1.e-3) && (p[2] < pmin)) // reverse { pmin = p[1]; pmax = p[0]; forward = false; } - else if ((std::abs(pmax - pfirst) <1.e-3) && (p[2] > pmin)) // forward, replace pmax par plast + else if ((std::fabs(pmax - pfirst) <1.e-3) && (p[2] > pmin)) // forward, replace pmax par plast pmax = plast; } DEBTRACE("forward: "<< forward << " pmin " << pmin << " pmax " << pmax); diff --git a/src/HYDRO_tests/test_HYDROData_CalcCase.cxx b/src/HYDRO_tests/test_HYDROData_CalcCase.cxx index 4fd6a868..91141a7c 100644 --- a/src/HYDRO_tests/test_HYDROData_CalcCase.cxx +++ b/src/HYDRO_tests/test_HYDROData_CalcCase.cxx @@ -305,7 +305,7 @@ void test_HYDROData_CalcCase::test_complete_2() Handle(HYDROData_Object) aNewZone1c = Handle(HYDROData_Object)::DownCast( aNewZone1 ); BRepGProp::SurfaceProperties(aNewZone1c->GetTopShape(), G1); - double diff = abs(G1.Mass()-m); //there is still a difference after calling of general fuse on complicated cases + double diff = fabs(G1.Mass()-m); //there is still a difference after calling of general fuse on complicated cases CPPUNIT_ASSERT(diff < 20.0); CPPUNIT_ASSERT_DOUBLES_EQUAL(23387.2, G1.Mass(), 0.1); CPPUNIT_ASSERT_DOUBLES_EQUAL(23370.1, m, 0.1);