From 536d2a3026c15e952be5fd37ac4c971e594f5cdd Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 22 Dec 2020 08:19:56 +0100 Subject: [PATCH] [GL] fabs -> std::abs; std::fabs -> std::abs. --- GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp | 6 ++++-- GeoLib/Raster.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp index 465c4cf1fa0..df88156fb89 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp @@ -208,7 +208,9 @@ void XmlStnInterface::readStratigraphy( const QDomNode &stratRoot, /* add other horizon features here */ double depth (horizon.attribute("z").toDouble()); - if (fabs(depth - depth_check) > std::numeric_limits<double>::epsilon()) // skip soil-layer if its thickness is zero + if (std::abs(depth - depth_check) > + std::numeric_limits<double>:: + epsilon()) // skip soil-layer if its thickness is zero { borehole->addSoilLayer(horizon.attribute("x").toDouble(), horizon.attribute("y").toDouble(), @@ -326,7 +328,7 @@ void XmlStnInterface::writeBoreholeData(QDomDocument &doc, boreholeTag.appendChild(stationDepthTag); QDomText stationDepthText = doc.createTextNode(QString::number(borehole->getDepth(), 'f')); stationDepthTag.appendChild(stationDepthText); - if (fabs(borehole->getDate()) > 0) + if (std::abs(borehole->getDate()) > 0) { QDomElement stationDateTag = doc.createElement("bdate"); boreholeTag.appendChild(stationDateTag); diff --git a/GeoLib/Raster.cpp b/GeoLib/Raster.cpp index 7336958d5de..48623dd4038 100644 --- a/GeoLib/Raster.cpp +++ b/GeoLib/Raster.cpp @@ -88,8 +88,8 @@ double Raster::interpolateValueAtPoint(MathLib::Point3d const& pnt) const double const yIdx (std::floor(yPos)); // so not to over- or underflow. // weights for bilinear interpolation - double const xShift = std::fabs((xPos - xIdx) - 0.5); - double const yShift = std::fabs((yPos - yIdx) - 0.5); + double const xShift = std::abs((xPos - xIdx) - 0.5); + double const yShift = std::abs((yPos - yIdx) - 0.5); std::array<double,4> weight = {{ (1-xShift)*(1-yShift), xShift*(1-yShift), xShift*yShift, (1-xShift)*yShift }}; // neighbors to include in interpolation @@ -119,7 +119,8 @@ double Raster::interpolateValueAtPoint(MathLib::Point3d const& pnt) const } // remove no data values - if (std::fabs(pix_val[j] - _header.no_data) < std::numeric_limits<double>::epsilon()) + if (std::abs(pix_val[j] - _header.no_data) < + std::numeric_limits<double>::epsilon()) { weight[j] = 0; no_data_count++; -- GitLab