diff --git a/crnlib/crn_threaded_clusterizer.h b/crnlib/crn_threaded_clusterizer.h index cd2acf4e..467596cd 100644 --- a/crnlib/crn_threaded_clusterizer.h +++ b/crnlib/crn_threaded_clusterizer.h @@ -219,7 +219,7 @@ class threaded_clusterizer { double sum = 0; for (uint j = 0; j < N; j++) - sum += axis[j] * covar[i][j]; + sum += static_cast(axis[j]) * static_cast(covar[i][j]); x[i] = static_cast(sum); diff --git a/crnlib/crn_tree_clusterizer.h b/crnlib/crn_tree_clusterizer.h index d6785c3b..6d05af10 100644 --- a/crnlib/crn_tree_clusterizer.h +++ b/crnlib/crn_tree_clusterizer.h @@ -72,7 +72,7 @@ class tree_clusterizer { m_weightedVectors[i] = v * (float)weight; root.m_centroid += m_weightedVectors[i]; root.m_total_weight += weight; - m_weightedDotProducts[i] = v.dot(v) * weight; + m_weightedDotProducts[i] = static_cast(v.dot(v)) * static_cast(weight); ttsum += m_weightedDotProducts[i]; } root.m_variance = (float)(ttsum - (root.m_centroid.dot(root.m_centroid) / root.m_total_weight)); @@ -289,7 +289,7 @@ class tree_clusterizer { double sum = 0; for (uint j = 0; j < N; j++) - sum += axis[j] * covar[i][j]; + sum += static_cast(axis[j]) * static_cast(covar[i][j]); x[i] = (float)sum;