From 791cd51356f38b482d8289e2ab50603aaaadb0af Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 9 May 2023 01:25:01 +0200 Subject: [PATCH] refactor: cleanup variables namespace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils/Utils.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index be372de6..37f76911 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -366,15 +366,15 @@ export class Utils { return sortedDataSet[sortedDataSet.length - 1]; } const percentileIndexBase = (percentile / 100) * (sortedDataSet.length - 1); - const percentileIntegerIndex = Math.floor(percentileIndexBase); - if (!Utils.isNullOrUndefined(sortedDataSet[percentileIntegerIndex + 1])) { + const percentileIndexInteger = Math.floor(percentileIndexBase); + if (!Utils.isNullOrUndefined(sortedDataSet[percentileIndexInteger + 1])) { return ( - sortedDataSet[percentileIntegerIndex] + - (percentileIndexBase - percentileIntegerIndex) * - (sortedDataSet[percentileIntegerIndex + 1] - sortedDataSet[percentileIntegerIndex]) + sortedDataSet[percentileIndexInteger] + + (percentileIndexBase - percentileIndexInteger) * + (sortedDataSet[percentileIndexInteger + 1] - sortedDataSet[percentileIndexInteger]) ); } - return sortedDataSet[percentileIntegerIndex]; + return sortedDataSet[percentileIndexInteger]; } public static stdDeviation(dataSet: number[]): number { -- 2.34.1