From 722a7f6978d769ccaa631a15f8ede03752554e7e Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 3 Jan 2026 16:05:29 +0530 Subject: [PATCH 1/2] feat: add C APIs for half-precision floating-point number utilities --- 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: na - 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 --- --- .../@stdlib/number/float16/README.md | 167 ++++++++++++++++++ .../number/float16/docs/types/index.d.ts | 33 ++++ .../@stdlib/number/float16/docs/types/test.ts | 28 +++ .../@stdlib/number/float16/examples/index.js | 24 +++ .../float16/include/stdlib/number/float16.h | 32 ++++ .../@stdlib/number/float16/lib/browser.js | 28 +++ .../@stdlib/number/float16/lib/index.js | 39 ++++ .../@stdlib/number/float16/lib/main.js | 40 +++++ .../@stdlib/number/float16/manifest.json | 45 +++++ .../@stdlib/number/float16/package.json | 73 ++++++++ .../number/float16/test/test.browser.js | 33 ++++ .../@stdlib/number/float16/test/test.js | 48 +++++ 12 files changed, 590 insertions(+) create mode 100644 lib/node_modules/@stdlib/number/float16/README.md create mode 100644 lib/node_modules/@stdlib/number/float16/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/number/float16/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/number/float16/examples/index.js create mode 100644 lib/node_modules/@stdlib/number/float16/include/stdlib/number/float16.h create mode 100644 lib/node_modules/@stdlib/number/float16/lib/browser.js create mode 100644 lib/node_modules/@stdlib/number/float16/lib/index.js create mode 100644 lib/node_modules/@stdlib/number/float16/lib/main.js create mode 100644 lib/node_modules/@stdlib/number/float16/manifest.json create mode 100644 lib/node_modules/@stdlib/number/float16/package.json create mode 100644 lib/node_modules/@stdlib/number/float16/test/test.browser.js create mode 100644 lib/node_modules/@stdlib/number/float16/test/test.js diff --git a/lib/node_modules/@stdlib/number/float16/README.md b/lib/node_modules/@stdlib/number/float16/README.md new file mode 100644 index 000000000000..b26e6ccc9bc5 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/README.md @@ -0,0 +1,167 @@ + + +# Native Add-ons + +> C APIs for half-precision floating-point number utility functions. + + + +
+ +This package exposes an absolute file path for the directory containing header files for various C APIs. The various C APIs provide utilities for working with half-precision floating-point numbers, including type conversion, component extraction, and bit-level manipulation. + +
+ + + + + +
+ +## Usage + +```javascript +var headerDir = require( '@stdlib/number/float16' ); +``` + +#### headerDir + +Absolute file path for the directory containing header files for C APIs. + +```javascript +var dir = headerDir; +// returns +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + +```javascript +var headerDir = require( '@stdlib/number/float16' ); + +console.log( headerDir ); +// => +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +This package exposes various C APIs for working with half-precision floating-point numbers. The included C APIs are the APIs implemented in the following packages: + + + +For API documentation, consult the individual packages. + +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/number/float16.h" +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/number/float16.h" +``` + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/number/float16/docs/types/index.d.ts b/lib/node_modules/@stdlib/number/float16/docs/types/index.d.ts new file mode 100644 index 000000000000..ea3cf325e875 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/docs/types/index.d.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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 + +/** +* Absolute file path for the directory containing header files for C APIs of half-precision floating-point number utility functions. +* +* @example +* var dir = headerDir; +* // returns +*/ +declare const headerDir: string; + + +// EXPORTS // + +export = headerDir; diff --git a/lib/node_modules/@stdlib/number/float16/docs/types/test.ts b/lib/node_modules/@stdlib/number/float16/docs/types/test.ts new file mode 100644 index 000000000000..6df3096e67da --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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 headerDir = require( './index' ); + + +// TESTS // + +// The variable is a string... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + headerDir; // $ExpectType string +} diff --git a/lib/node_modules/@stdlib/number/float16/examples/index.js b/lib/node_modules/@stdlib/number/float16/examples/index.js new file mode 100644 index 000000000000..d6ded1a29e22 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 headerDir = require( './../lib' ); + +console.log( headerDir ); +// => diff --git a/lib/node_modules/@stdlib/number/float16/include/stdlib/number/float16.h b/lib/node_modules/@stdlib/number/float16/include/stdlib/number/float16.h new file mode 100644 index 000000000000..bcde9a7517a3 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/include/stdlib/number/float16.h @@ -0,0 +1,32 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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_NUMBER_FLOAT16_H +#define STDLIB_NUMBER_FLOAT16_H + +// Note: keep in alphabetical order... +#include "stdlib/number/float16/ctor.h" +#include "stdlib/number/float16/base/exponent.h" +#include "stdlib/number/float16/base/from_word.h" +#include "stdlib/number/float16/base/signbit.h" +#include "stdlib/number/float16/base/significand.h" +#include "stdlib/number/float16/base/to_float32.h" +#include "stdlib/number/float16/base/to_float64.h" +#include "stdlib/number/float16/base/to_word.h" + +#endif // !STDLIB_NUMBER_FLOAT16_H diff --git a/lib/node_modules/@stdlib/number/float16/lib/browser.js b/lib/node_modules/@stdlib/number/float16/lib/browser.js new file mode 100644 index 000000000000..3f9ff06107b3 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/lib/browser.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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'; + +// MAIN // + +var headerDir = null; + + +// EXPORTS // + +module.exports = headerDir; diff --git a/lib/node_modules/@stdlib/number/float16/lib/index.js b/lib/node_modules/@stdlib/number/float16/lib/index.js new file mode 100644 index 000000000000..f7bcc9eb6427 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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'; + +/** +* Absolute file path for the directory containing header files for C APIs of half-precision floating-point number utility functions. +* +* @module @stdlib/number/float16 +* +* @example +* var headerDir = require( '@stdlib/number/float16' ); +* +* console.log( headerDir ); +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/number/float16/lib/main.js b/lib/node_modules/@stdlib/number/float16/lib/main.js new file mode 100644 index 000000000000..7156d9e3b57a --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/lib/main.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; + + +// MAIN // + +/** +* Absolute file path for the directory containing header files for C APIs of half-precision floating-point number utility functions. +* +* @name headerDir +* @constant +* @type {string} +*/ +var headerDir = resolve( __dirname, '..', 'include' ); + + +// EXPORTS // + +module.exports = headerDir; diff --git a/lib/node_modules/@stdlib/number/float16/manifest.json b/lib/node_modules/@stdlib/number/float16/manifest.json new file mode 100644 index 000000000000..65a49269a71f --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/manifest.json @@ -0,0 +1,45 @@ +{ + "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": [ + "@stdlib/number/float16/ctor", + "@stdlib/number/float16/base/exponent", + "@stdlib/number/float16/base/from-word", + "@stdlib/number/float16/base/signbit", + "@stdlib/number/float16/base/significand", + "@stdlib/number/float16/base/to-float32", + "@stdlib/number/float16/base/to-float64", + "@stdlib/number/float16/base/to-word" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/number/float16/package.json b/lib/node_modules/@stdlib/number/float16/package.json new file mode 100644 index 000000000000..3f6805c17c76 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/number/float16", + "version": "0.0.0", + "description": "C APIs for half-precision floating-point number utility functions.", + "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", + "browser": "./lib/browser.js", + "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", + "stdtypes", + "types", + "data", + "structure", + "floating-point", + "float16", + "16-bit", + "integer", + "float", + "half", + "half-precision", + "ieee754", + "addon" + ], + "__stdlib__": { + "envs": { + "browser": false + } + } +} diff --git a/lib/node_modules/@stdlib/number/float16/test/test.browser.js b/lib/node_modules/@stdlib/number/float16/test/test.browser.js new file mode 100644 index 000000000000..64de4bf16d9c --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/test/test.browser.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 headerDir = require( './../lib/browser.js' ); + + +// TESTS // + +tape( 'main export is null', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( headerDir, null, 'main export is null' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/number/float16/test/test.js b/lib/node_modules/@stdlib/number/float16/test/test.js new file mode 100644 index 000000000000..b07fdee0470e --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/test/test.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var headerDir = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a string', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof headerDir, 'string', 'main export is a string' ); + t.end(); +}); + +tape( 'the exported value corresponds to the package directory containing header files', opts, function test( t ) { + var dir = resolve( __dirname, '..', 'include' ); + t.strictEqual( headerDir, dir, 'exports expected value' ); + t.end(); +}); From e94969b413a5c8c86a1f75024ed04f1acd55f5ef Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 3 Jan 2026 20:52:01 +0530 Subject: [PATCH 2/2] refactor: update as per suggested --- .../@stdlib/number/float16/README.md | 130 +++++------------- .../number/float16/docs/types/index.d.ts | 55 +++++++- .../@stdlib/number/float16/docs/types/test.ts | 9 +- .../@stdlib/number/float16/examples/index.js | 6 +- .../@stdlib/number/float16/lib/browser.js | 28 ---- .../@stdlib/number/float16/lib/index.js | 59 ++++++-- .../@stdlib/number/float16/lib/main.js | 40 ------ .../@stdlib/number/float16/package.json | 12 +- .../number/float16/test/test.browser.js | 33 ----- .../@stdlib/number/float16/test/test.js | 22 +-- 10 files changed, 148 insertions(+), 246 deletions(-) delete mode 100644 lib/node_modules/@stdlib/number/float16/lib/browser.js delete mode 100644 lib/node_modules/@stdlib/number/float16/lib/main.js delete mode 100644 lib/node_modules/@stdlib/number/float16/test/test.browser.js diff --git a/lib/node_modules/@stdlib/number/float16/README.md b/lib/node_modules/@stdlib/number/float16/README.md index b26e6ccc9bc5..3f6c4dbe13ba 100644 --- a/lib/node_modules/@stdlib/number/float16/README.md +++ b/lib/node_modules/@stdlib/number/float16/README.md @@ -18,138 +18,64 @@ limitations under the License. --> -# Native Add-ons +# Float16 -> C APIs for half-precision floating-point number utility functions. - - - -
- -This package exposes an absolute file path for the directory containing header files for various C APIs. The various C APIs provide utilities for working with half-precision floating-point numbers, including type conversion, component extraction, and bit-level manipulation. - -
- - - - +> Utilities for half-precision floating-point numbers.
## Usage ```javascript -var headerDir = require( '@stdlib/number/float16' ); +var ns = require( '@stdlib/number/float16' ); ``` -#### headerDir +#### ns -Absolute file path for the directory containing header files for C APIs. +Utilities for half-precision floating-point numbers. ```javascript -var dir = headerDir; -// returns +var o = ns; +// returns {...} ``` -
- - - - - -
+The namespace contains the following: -
+ - +
- +- [`base`][@stdlib/number/float16/base]: base utilities for half-precision floating-point numbers. +- [`reviver( key, value )`][@stdlib/number/float16/reviver]: revive a JSON-serialized number. +- [`toJSON( x )`][@stdlib/number/float16/to-json]: return a JSON representation of a number. -
+
-## Examples - -```javascript -var headerDir = require( '@stdlib/number/float16' ); - -console.log( headerDir ); -// => -``` - - - - - - - -* * * - -
- -## C APIs - - - -
- -This package exposes various C APIs for working with half-precision floating-point numbers. The included C APIs are the APIs implemented in the following packages: - - - -For API documentation, consult the individual packages. - -
- - - - - -
- -### Usage - -```c -#include "stdlib/number/float16.h" -``` +
- - -
- -
+
- +## Examples - + -
+ -### Examples +```javascript +var objectKeys = require( '@stdlib/utils/keys' ); +var ns = require( '@stdlib/number/float16' ); -```c -#include "stdlib/number/float16.h" +console.log( objectKeys( ns ) ); ```
-
- - - - - -
- -
- - -