From: Chris Duncan Date: Fri, 25 Apr 2025 20:39:14 +0000 (-0700) Subject: Fix sorting bug in test page to get correct median. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=b1acb3b93041c9295f8879ebea8dbad05e8d4fe5;p=nano-pow.git Fix sorting bug in test page to get correct median. --- diff --git a/test/index.html b/test/index.html index 397ef8b..b84a6a8 100644 --- a/test/index.html +++ b/test/index.html @@ -35,7 +35,7 @@ SPDX-License-Identifier: GPL-3.0-or-later function average (times, type, effort) { let count = times.length, truncatedCount = 0, sum = 0, truncated = 0, reciprocals = 0, logarithms = 0, min = Number.MAX_SAFE_INTEGER, max = 0, median = 0, rate = 0 - times.sort() + times.sort((a, b) => a - b) for (let i = 0; i < count; i++) { sum += times[i] reciprocals += 1 / times[i]