LGTM: Eliminate float-to-double overflow warning

LGTM complains if this calculation is done from inside the sqrt() call
because it sees the explicit cast to float and assumes that sqrt() is
intended to take a double. By adding an intermediate step it should be
clear to LGTM that the float version of sqrt is intended.
This commit is contained in:
Chris Hennes
2021-02-09 10:20:54 -06:00
committed by wwmayer
parent 5269d10327
commit 5d0cf1081e

View File

@@ -291,7 +291,8 @@ void MeshGrid::CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxG
else
fAreaElem = fArea / float(_ulCtElements);
fGridLen = sqrt(fAreaElem * float(ulCtGrid));
float fRepresentativeArea = fAreaElem * static_cast<float>(ulCtGrid);
fGridLen = sqrt(fRepresentativeArea);
}
if (fGridLen > 0) {