Skip to content

Commit fda1211

Browse files
committed
feat: add implementation
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8514fc9 commit fda1211

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* Bradford distribution mode.
23+
*
24+
* @module @stdlib/stats/base/dists/bradford/mode
25+
*
26+
* @example
27+
* var mode = require( '@stdlib/stats/base/dists/bradford/mode' );
28+
*
29+
* var v = mode( 0.1 );
30+
* // returns 0.0
31+
*
32+
* v = mode( 0.5 );
33+
* // returns 0.0
34+
*/
35+
36+
// MODULES //
37+
38+
var mode = require( './main.js' );
39+
40+
41+
// EXPORTS //
42+
43+
module.exports = mode;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
24+
25+
26+
// MAIN //
27+
28+
/**
29+
* Returns the mode of a Bradford distribution.
30+
*
31+
* @param {number} c - shape parameter
32+
* @returns {number} mode
33+
*
34+
* @example
35+
* var v = mode( 0.1 );
36+
* // returns 0.0
37+
*
38+
* @example
39+
* var v = mode( 0.5 );
40+
* // returns 0.0
41+
*
42+
* @example
43+
* var v = mode( 10.0 );
44+
* // returns 0.0
45+
*
46+
* @example
47+
* var v = mode( 0.0 );
48+
* // returns NaN
49+
*
50+
* @example
51+
* var v = mode( -1.0 );
52+
* // returns NaN
53+
*
54+
* @example
55+
* var v = mode( NaN );
56+
* // returns NaN
57+
*/
58+
function mode( c ) {
59+
if (
60+
isnan( c ) ||
61+
c <= 0.0
62+
) {
63+
return NaN;
64+
}
65+
return 0.0;
66+
}
67+
68+
69+
// EXPORTS //
70+
71+
module.exports = mode;

0 commit comments

Comments
 (0)