MCPcopy
hub / github.com/webpack/webpack / tDistribution

Function tDistribution

test/BenchmarkTestCases.benchmark.mjs:167–195  ·  view source on GitHub ↗

* @param {number} n number of runs * @returns {number} distribution

(n)

Source from the content-addressed store, hash-verified

165 * @returns {number} distribution
166 */
167function tDistribution(n) {
168 if (n === 0) {
169 return 1;
170 }
171
172 // two-sided, 90%
173 // https://en.wikipedia.org/wiki/Student%27s_t-distribution
174 if (n <= 30) {
175 // 1 2 ...
176 const data = [
177 6.314, 2.92, 2.353, 2.132, 2.015, 1.943, 1.895, 1.86, 1.833, 1.812, 1.796,
178 1.782, 1.771, 1.761, 1.753, 1.746, 1.74, 1.734, 1.729, 1.725, 1.721,
179 1.717, 1.714, 1.711, 1.708, 1.706, 1.703, 1.701, 1.699, 1.697
180 ];
181 return data[n - 1];
182 } else if (n <= 120) {
183 // 30 40 50 60 70 80 90 100 110 120
184 const data = [
185 1.697, 1.684, 1.676, 1.671, 1.667, 1.664, 1.662, 1.66, 1.659, 1.658
186 ];
187 const a = data[Math.floor(n / 10) - 3];
188 const b = data[Math.ceil(n / 10) - 3];
189 const f = n / 10 - Math.floor(n / 10);
190
191 return a * (1 - f) + b * f;
192 }
193
194 return 1.645;
195}
196
197const output = path.join(__dirname, "js");
198const baselinesPath = path.join(output, "benchmark-baselines");

Calls

no outgoing calls

Tested by

no test coverage detected