mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix many issues reported by clang-tidy (#7189)
* Fix many issues reported by clang-tidy We have many issues in code related to some performance to float <-> double. Clang-tidy reported it in performance-type-promotion-in-math-fn I fixed many of them. It's not ready for a promote to blocking Also fix some value which should be const-ref
This commit is contained in:
parent
e98fd934ce
commit
2481ea27ce
14 changed files with 61 additions and 52 deletions
|
@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
#include "test.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "util/numeric.h"
|
||||
#include "util/string.h"
|
||||
|
||||
|
@ -111,13 +112,13 @@ void TestUtilities::testAngleWrapAround()
|
|||
UASSERT(fabs(modulo360f(-365.5) - (-5.5)) < 0.001);
|
||||
|
||||
for (float f = -720; f <= -360; f += 0.25) {
|
||||
UASSERT(fabs(modulo360f(f) - modulo360f(f + 360)) < 0.001);
|
||||
UASSERT(std::fabs(modulo360f(f) - modulo360f(f + 360)) < 0.001);
|
||||
}
|
||||
|
||||
for (float f = -1440; f <= 1440; f += 0.25) {
|
||||
UASSERT(fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
|
||||
UASSERT(fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
|
||||
UASSERT(fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
|
||||
UASSERT(std::fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
|
||||
UASSERT(std::fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
|
||||
UASSERT(std::fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
|
||||
UASSERT(wrapDegrees_0_360(fabs(wrapDegrees_180(f) - wrapDegrees_0_360(f))) < 0.001);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue