From 2d4a065e3574812f380c788c7d7b530c2f994bc7 Mon Sep 17 00:00:00 2001 From: Navyansh Kesarwani Date: Fri, 19 Dec 2025 20:20:46 +0530 Subject: [PATCH] feat: implemented max-nth-double-factorial missing constant --- 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: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../max-nth-double-factorial/README.md | 164 ++++++++++++++++++ .../max-nth-double-factorial/docs/repl.txt | 13 ++ .../docs/types/index.d.ts | 33 ++++ .../docs/types/test.ts | 28 +++ .../examples/index.js | 43 +++++ .../float16/max_nth_double_factorial.h | 27 +++ .../max-nth-double-factorial/lib/index.js | 51 ++++++ .../max-nth-double-factorial/manifest.json | 36 ++++ .../max-nth-double-factorial/package.json | 69 ++++++++ .../max-nth-double-factorial/test/test.js | 38 ++++ 10 files changed, 502 insertions(+) create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/README.md create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/examples/index.js create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/include/stdlib/constants/float16/max_nth_double_factorial.h create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/lib/index.js create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/manifest.json create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/package.json create mode 100644 lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/test/test.js diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/README.md b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/README.md new file mode 100644 index 000000000000..fa0460604e10 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/README.md @@ -0,0 +1,164 @@ + + +# FLOAT16_MAX_NTH_DOUBLE_FACTORIAL + +> Maximum nth [double factorial][double-factorial] when stored in [half-precision floating-point][ieee754] format. + +
+ +## Usage + + + +```javascript +var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float16/max-nth-double-factorial' ); +``` + +#### FLOAT16_MAX_NTH_DOUBLE_FACTORIAL + +The maximum nth [double factorial][double-factorial] when stored in [half-precision floating-point][ieee754] format. + + + +```javascript +var bool = ( FLOAT16_MAX_NTH_DOUBLE_FACTORIAL === 12 ); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float16/max-nth-double-factorial' ); + +function factorial2( n ) { + var a; + var i; + + a = 1; + for ( i = n; i >= 2; i -= 2 ) { + a *= i; + } + return a; +} + +var v; +var i; +for ( i = 0; i < 100; i++ ) { + v = factorial2( i ); + if ( i > FLOAT16_MAX_NTH_DOUBLE_FACTORIAL ) { + console.log( 'Overflow: %d', v ); + } else { + console.log( 'Valid: %d', v ); + } +} +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/constants/float16/max_nth_double_factorial.h" +``` + +#### STDLIB_CONSTANT_FLOAT16_MAX_NTH_DOUBLE_FACTORIAL + +Macro for the maximum nth [double factorial][double-factorial] when stored in [half-precision floating-point][ieee754] format. + +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/repl.txt b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/repl.txt new file mode 100644 index 000000000000..c922417f7f26 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/repl.txt @@ -0,0 +1,13 @@ + +{{alias}} + Maximum nth double factorial when stored in half-precision floating-point + format. + + Examples + -------- + > {{alias}} + 12 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/index.d.ts new file mode 100644 index 000000000000..80aabb44a8ed --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/index.d.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Maximum nth double factorial when stored in half-precision floating-point format. +* +* @example +* var max = FLOAT16_MAX_NTH_DOUBLE_FACTORIAL; +* // returns 12 +*/ +declare const FLOAT16_MAX_NTH_DOUBLE_FACTORIAL: number; + + +// EXPORTS // + +export = FLOAT16_MAX_NTH_DOUBLE_FACTORIAL; diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/test.ts new file mode 100644 index 000000000000..85a1d616097d --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT16_MAX_NTH_DOUBLE_FACTORIAL; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/examples/index.js b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/examples/index.js new file mode 100644 index 000000000000..cd6d4cbf685d --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/examples/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( './../lib' ); // eslint-disable-line id-length + +function factorial2( n ) { + var a; + var i; + + a = 1; + for ( i = n; i >= 2; i -= 2 ) { + a *= i; + } + return a; +} + +var v; +var i; +for ( i = 0; i < 100; i++ ) { + v = factorial2( i ); + if ( i > FLOAT16_MAX_NTH_DOUBLE_FACTORIAL ) { + console.log( 'Overflow: %d', v ); + } else { + console.log( 'Valid: %d', v ); + } +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/include/stdlib/constants/float16/max_nth_double_factorial.h b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/include/stdlib/constants/float16/max_nth_double_factorial.h new file mode 100644 index 000000000000..08086ca50e39 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/include/stdlib/constants/float16/max_nth_double_factorial.h @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_CONSTANTS_FLOAT16_MAX_NTH_DOUBLE_FACTORIAL_H +#define STDLIB_CONSTANTS_FLOAT16_MAX_NTH_DOUBLE_FACTORIAL_H + +/** +* Macro for the maximum nth double factorial when stored in half-precision floating-point format. +*/ +#define STDLIB_CONSTANT_FLOAT16_MAX_NTH_DOUBLE_FACTORIAL 12 + +#endif // !STDLIB_CONSTANTS_FLOAT16_MAX_NTH_DOUBLE_FACTORIAL_H diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/lib/index.js b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/lib/index.js new file mode 100644 index 000000000000..9eab9dab3674 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/lib/index.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable id-length */ + +'use strict'; + +/** +* Maximum nth double factorial when stored in half-precision floating-point format. +* +* @module @stdlib/constants/float16/max-nth-double-factorial +* @type {integer32} +* +* @example +* var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float16/max-nth-double-factorial' ); +* // returns 12 +*/ + + +// MAIN // + +/** +* The maximum nth double factorial when stored in half-precision floating-point format. +* +* @constant +* @type {integer32} +* @default 12 +* @see [double factorial]{@link https://en.wikipedia.org/wiki/Double_factorial} +* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} +*/ +var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = 12|0; // asm type annotation + + +// EXPORTS // + +module.exports = FLOAT16_MAX_NTH_DOUBLE_FACTORIAL; diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/manifest.json b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/manifest.json @@ -0,0 +1,36 @@ +{ + "options": {}, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "src": [], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [] + } + ] +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/package.json b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/package.json new file mode 100644 index 000000000000..1e856c5d5f3a --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/constants/float16/max-nth-double-factorial", + "version": "0.0.0", + "description": "Maximum nth double factorial when stored in half-precision floating-point format.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "constant", + "const", + "max", + "maximum", + "factorial2", + "number", + "integer", + "float", + "floating", + "point", + "floating-point", + "float16", + "half", + "ieee754" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/test/test.js b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/test/test.js new file mode 100644 index 000000000000..eee6dbeafc5b --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-double-factorial/test/test.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( './../lib' ); // eslint-disable-line id-length + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof FLOAT16_MAX_NTH_DOUBLE_FACTORIAL, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'the exported value is 12', function test( t ) { + t.strictEqual( FLOAT16_MAX_NTH_DOUBLE_FACTORIAL, 12, 'returns expected value' ); + t.end(); +});