Skip to content

Commit

Permalink
classify: Modernize function UniformDensity
Browse files Browse the repository at this point in the history
This should fix an issue reported by Codacy.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Apr 7, 2019
1 parent 72c8741 commit 3dfe1b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/classify/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1829,12 +1829,13 @@ static double NormalDensity(int32_t x) {
* @return The value of the uniform distribution at x.
*/
static double UniformDensity(int32_t x) {
static double UniformDistributionDensity = 1.0 / BUCKETTABLESIZE;
constexpr auto UniformDistributionDensity = 1.0 / BUCKETTABLESIZE;

if ((x >= 0.0) && (x <= BUCKETTABLESIZE))
if ((x >= 0) && (x <= BUCKETTABLESIZE)) {
return UniformDistributionDensity;
else
} else {
return 0.0;
}
} // UniformDensity

/**
Expand Down

0 comments on commit 3dfe1b8

Please sign in to comment.