Skip to content

Commit

Permalink
change floating-point loop variables to iterate on a fixed-size array.
Browse files Browse the repository at this point in the history
SonarCloud doesn't like floating-point variables in for loops. This
spells out precisely what values are used in the loops.

Signed-off-by: Cary Phillips <cary@ilm.com>
  • Loading branch information
cary-ilm committed Oct 7, 2019
1 parent bd7a04f commit 09a14a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions IlmBase/ImathTest/testFrustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf &frustum)
IMATH_INTERNAL_NAMESPACE::V3f o (0.0f, 0.0f, 0.0f);
float eps = 5.0e-4;

for (float xRo = 0.0f; xRo < 360.0f; xRo += 100.0f)
for (auto xRo : {0.0f, 100.0f, 200.0f})
{
for (float yRo = 0.0f; yRo < 360.0f; yRo += 105.0f)
for (auto yRo : {0.0f, 105.0f, 210.0f, 315.0f})
{
for (float zRo = 0.0f; zRo < 360.0f; zRo += 110.0f)
for (auto zRo : {0.0f, 110.0f, 220.0f, 330.0f})
{
for (float xTr = -10.0f; xTr < 10.0f; xTr += 2)
for (auto xTr : {-10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f})
{
for (float yTr = -10.0f; yTr < 10.0f; yTr += 3)
for (auto yTr : {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f})
{
for (float zTr = -10.0f; zTr < 10.0f; zTr += 4)
for (auto zTr : {-10.0f, -6.0f, -2.0f, 2.0f, 6.0f})
{
float xRoRad = xRo * (2.0f * float(M_PI) / 360.0f);
float yRoRad = yRo * (2.0f * float(M_PI) / 360.0f);
Expand Down

0 comments on commit 09a14a9

Please sign in to comment.