To calculate the variance, we subtract the mean from each number in the dataset, square these differences, sum them up, and then find the average of these squared differences. This method helps in quantifying how much the numbers in the dataset deviate from the mean.
The issue at hand here is that we will in most cases inevatibily run into an underflow error since not each number is bigger than the mean.
The mean is calculated as the sum of all numbers in the data array divided by data.length. By nature, we expect some numbers to be above the mean and some below it. The current library used to calculate variance does not account for numbers below the mean, leading to underflows.
As a result this calculation will underflow when data[i] < mean.
Calculations cannot move forward, finalizeValidtion will revert, and thus validations may not be finalized.
Changes are imperative in order to avoid underflows.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.