diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/README.md b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/README.md new file mode 100644 index 000000000000..2f023031c281 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/README.md @@ -0,0 +1,158 @@ + + +# FLOAT16_MAX_NTH_FACTORIAL + +> Maximum nth [factorial][factorial] when stored in [half-precision floating-point][half-precision-floating-point-format] format. + +
+ +## Usage + +```javascript +var FLOAT16_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float16/max-nth-factorial' ); +``` + +#### FLOAT16_MAX_NTH_FACTORIAL + +The maximum nth [factorial][factorial] when stored in [half-precision floating-point][half-precision-floating-point-format] format. + +```javascript +var bool = ( FLOAT16_MAX_NTH_FACTORIAL === 10 ); +// returns true +``` + +
+ + + +
+ +## Examples + + + +```javascript +var FLOAT16_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float16/max-nth-factorial' ); + +function factorial( n ) { + var a; + var i; + + a = 1; + for ( i = 2; i <= n; i++ ) { + a *= i; + } + return a; +} + +var v; +var i; +for ( i = 0; i < 50; i++ ) { + v = factorial( i ); + if ( i > FLOAT16_MAX_NTH_FACTORIAL ) { + console.log( 'Overflow: %d', v ); + } else { + console.log( 'Valid: %d', v ); + } +} +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/constants/float16/max_nth_factorial.h" +``` + +#### STDLIB_CONSTANT_FLOAT16_MAX_NTH_FACTORIAL + +Macro for the maximum nth [factorial][factorial] when stored in [half-precision floating-point][half-precision-floating-point-format] format. + +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/repl.txt b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/repl.txt new file mode 100644 index 000000000000..86700685c475 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/repl.txt @@ -0,0 +1,13 @@ + +{{alias}} + Maximum nth factorial when stored in half-precision floating-point + format. + + Examples + -------- + > {{alias}} + 10 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/types/index.d.ts new file mode 100644 index 000000000000..7bf0521a92b0 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-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 factorial when stored in half-precision floating-point format. +* +* @example +* var max = FLOAT16_MAX_NTH_FACTORIAL; +* // returns 10 +*/ +declare const FLOAT16_MAX_NTH_FACTORIAL: number; + + +// EXPORTS // + +export = FLOAT16_MAX_NTH_FACTORIAL; diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/docs/types/test.ts new file mode 100644 index 000000000000..35550af0aa95 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-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_FACTORIAL = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT16_MAX_NTH_FACTORIAL; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/examples/index.js b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/examples/index.js new file mode 100644 index 000000000000..6a19795e4a7b --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-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_FACTORIAL = require( './../lib' ); + +function factorial( n ) { + var a; + var i; + + a = 1; + for ( i = 2; i <= n; i++ ) { + a *= i; + } + return a; +} + +var v; +var i; +for ( i = 0; i < 50; i++ ) { + v = factorial( i ); + if ( i > FLOAT16_MAX_NTH_FACTORIAL ) { + console.log( 'Overflow: %d', v ); + } else { + console.log( 'Valid: %d', v ); + } +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/include/stdlib/constants/float16/max_nth_factorial.h b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/include/stdlib/constants/float16/max_nth_factorial.h new file mode 100644 index 000000000000..c2f88bdcb647 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/include/stdlib/constants/float16/max_nth_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_FACTORIAL_H +#define STDLIB_CONSTANTS_FLOAT16_MAX_NTH_FACTORIAL_H + +/** +* Macro for the maximum nth factorial when stored in half-precision floating-point format. +*/ +#define STDLIB_CONSTANT_FLOAT16_MAX_NTH_FACTORIAL 10 + +#endif // !STDLIB_CONSTANTS_FLOAT16_MAX_NTH_FACTORIAL_H diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/lib/index.js b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/lib/index.js new file mode 100644 index 000000000000..0580a0a85f82 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/lib/index.js @@ -0,0 +1,49 @@ +/** +* @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'; + +/** +* Maximum nth factorial when stored in half-precision floating-point format. +* +* @module @stdlib/constants/float16/max-nth-factorial +* @type {integer} +* +* @example +* var FLOAT16_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float16/max-nth-factorial' ); +* // returns 10 +*/ + + +// MAIN // + +/** +* The maximum nth factorial when stored in half-precision floating-point format. +* +* @constant +* @type {integer} +* @default 10 +* @see [factorial]{@link https://en.wikipedia.org/wiki/Factorial} +* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format} +*/ +var FLOAT16_MAX_NTH_FACTORIAL = 10|0; // asm type annotation + + +// EXPORTS // + +module.exports = FLOAT16_MAX_NTH_FACTORIAL; diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/manifest.json b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-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-factorial/package.json b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/package.json new file mode 100644 index 000000000000..b370923c5c39 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/constants/float16/max-nth-factorial", + "version": "0.0.0", + "description": "Maximum nth 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", + "factorial", + "number", + "float", + "flt", + "floating", + "point", + "floating-point", + "float16", + "f16", + "half" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/test/test.js b/lib/node_modules/@stdlib/constants/float16/max-nth-factorial/test/test.js new file mode 100644 index 000000000000..bffbe46a545d --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/max-nth-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_FACTORIAL = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof FLOAT16_MAX_NTH_FACTORIAL, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'the exported value is 10', function test( t ) { + t.strictEqual( FLOAT16_MAX_NTH_FACTORIAL, 10, 'returns expected value' ); + t.end(); +});