You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-4516 check for var_pop < 0
In some cases, because of rounding error, var_pop will evaluate to some value just less than 0. We check for this and force to round to 0.
This commit is contained in:
@ -160,13 +160,13 @@ mcsv1_UDAF::ReturnCode corr::evaluate(mcsv1Context* context, static_any::any& va
|
||||
long double sumxy = data->sumxy;
|
||||
|
||||
long double var_popx = (sumx2 - (sumx * sumx / N)) / N;
|
||||
if (var_popx == 0)
|
||||
if (var_popx <= 0) // Catch -0
|
||||
{
|
||||
// When var_popx is 0, NULL is the result.
|
||||
return mcsv1_UDAF::SUCCESS;
|
||||
}
|
||||
long double var_popy = (sumy2 - (sumy * sumy / N)) / N;
|
||||
if (var_popy == 0)
|
||||
if (var_popy <= 0) // Catch -0
|
||||
{
|
||||
// When var_popy is 0, NULL is the result
|
||||
return mcsv1_UDAF::SUCCESS;
|
||||
|
Reference in New Issue
Block a user