fix: memcpy

This commit is contained in:
2025-12-07 18:52:39 -05:00
parent fb2a2fce59
commit 37b7fdce8f

View File

@@ -46,7 +46,7 @@ double percentile(const double *arr, size_t n, double perc) {
}
double *arr_copy = malloc(sizeof(double)*n);
memcpy(arr_copy, arr, n);
memcpy(arr_copy, arr, n*sizeof(double));
// nearest-rank: ceil(0.9*n) - 1
size_t k = (size_t)(perc*n) - 1;
double ans = select_k(arr_copy, n, k);