mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 14:44:12 +00:00
staging: iio: tsl2x7x_core: Fix standard deviation calculation
commitcf6c77323a
upstream. Standard deviation is calculated as the square root of the variance where variance is the mean of sample_sum and length. Correct the computation of statP->stddev in accordance to the proper calculation. Fixes:3c97c08b57
("staging: iio: add TAOS tsl2x7x driver") Reported-by: Abhiram Balasubramanian <abhiram@cs.utah.edu> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
773fdcdc09
commit
a1d51f7abf
1 changed files with 1 additions and 1 deletions
|
@ -854,7 +854,7 @@ void tsl2x7x_prox_calculate(int *data, int length,
|
|||
tmp = data[i] - statP->mean;
|
||||
sample_sum += tmp * tmp;
|
||||
}
|
||||
statP->stddev = int_sqrt((long)sample_sum) / length;
|
||||
statP->stddev = int_sqrt((long)sample_sum / length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue