From 5cda92a0602fac6139ed0379faf7affa62c302c1 Mon Sep 17 00:00:00 2001 From: sagar7162 Date: Thu, 25 Dec 2025 20:46:43 +0530 Subject: [PATCH 1/5] feat: add `number/float16/base/mul` --- 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: passed - 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/base/mul/README.md | 117 ++++++++++++++ .../float16/base/mul/benchmark/benchmark.js | 72 +++++++++ .../number/float16/base/mul/docs/repl.txt | 33 ++++ .../float16/base/mul/docs/types/index.d.ts | 53 +++++++ .../float16/base/mul/docs/types/test.ts | 58 +++++++ .../number/float16/base/mul/examples/index.js | 32 ++++ .../number/float16/base/mul/lib/index.js | 52 +++++++ .../number/float16/base/mul/lib/main.js | 62 ++++++++ .../number/float16/base/mul/package.json | 147 ++++++++++++++++++ .../number/float16/base/mul/test/test.js | 83 ++++++++++ 10 files changed, 709 insertions(+) create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/README.md create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/lib/index.js create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/lib/main.js create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/package.json create mode 100644 lib/node_modules/@stdlib/number/float16/base/mul/test/test.js diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/README.md b/lib/node_modules/@stdlib/number/float16/base/mul/README.md new file mode 100644 index 000000000000..7b2b354d91bf --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/README.md @@ -0,0 +1,117 @@ + + +# mul + +> Multiply two half-precision floating-point numbers. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var mul = require( '@stdlib/number/float16/base/mul' ); +``` + +#### mul( x, y ) + +Multiplies two half-precision floating-point numbers. + +```javascript +var v = mul( -1.0, 5.0 ); +// returns -5.0 + +v = mul( 2.0, 5.0 ); +// returns 10.0 + +v = mul( 0.0, 5.0 ); +// returns 0.0 + +v = mul( -0.0, 0.0 ); +// returns -0.0 + +v = mul( NaN, NaN ); +// returns NaN +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var rand = require( '@stdlib/random/base/discrete-uniform' ); +var mul = require( '@stdlib/number/float16/base/mul' ); + +var x; +var y; +var i; + +for ( i = 0; i < 100; i++ ) { + x = rand( -50, 50 ); + y = rand( -50, 50 ); + console.log( '%d x %d = %d', x, y, mul( x, y ) ); +} +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js b/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js new file mode 100644 index 000000000000..bbec40fe6299 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js @@ -0,0 +1,72 @@ +/** +* @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 bench = require( '@stdlib/bench' ); +var randu = require( '@stdlib/random/base/randu' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pkg = require( './../package.json' ).name; +var mul = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*1000.0 ) - 500.0; + y = mul( x, 5.0 ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::inline', function benchmark( b ) { + var x; + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*1000.0 ) - 500.0; + y = x * 5.0; + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/docs/repl.txt b/lib/node_modules/@stdlib/number/float16/base/mul/docs/repl.txt new file mode 100644 index 000000000000..ed04f2b9a1eb --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/docs/repl.txt @@ -0,0 +1,33 @@ + +{{alias}}( x, y ) + Multiplies two half-precision floating-point numbers `x` and `y`. + + Parameters + ---------- + x: number + First input value. + + y: number + Second input value. + + Returns + ------- + z: number + Result. + + Examples + -------- + > var v = {{alias}}( -1.0, 5.0 ) + -5.0 + > v = {{alias}}( 2.0, 5.0 ) + 10.0 + > v = {{alias}}( 0.0, 5.0 ) + 0.0 + > v = {{alias}}( -0.0, 0.0 ) + -0.0 + > v = {{alias}}( NaN, NaN ) + NaN + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/docs/types/index.d.ts b/lib/node_modules/@stdlib/number/float16/base/mul/docs/types/index.d.ts new file mode 100644 index 000000000000..92413b3ace89 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/docs/types/index.d.ts @@ -0,0 +1,53 @@ +/* +* @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 + +/** +* Multiplies two half-precision floating-point numbers `x` and `y`. +* +* @param x - first input value +* @param y - second input value +* @returns result +* +* @example +* var v = mul( -1.0, 5.0 ); +* // returns -5.0 +* +* @example +* var v = mul( 2.0, 5.0 ); +* // returns 10.0 +* +* @example +* var v = mul( 0.0, 5.0 ); +* // returns 0.0 +* +* @example +* var v = mul( -0.0, 0.0 ); +* // returns -0.0 +* +* @example +* var v = mul( NaN, NaN ); +* // returns NaN +*/ +declare function mul( x: number, y: number ): number; + + +// EXPORTS // + +export = mul; diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/docs/types/test.ts b/lib/node_modules/@stdlib/number/float16/base/mul/docs/types/test.ts new file mode 100644 index 000000000000..e0a34b50ecc8 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/docs/types/test.ts @@ -0,0 +1,58 @@ +/* +* @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 mul = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + mul( 8.0, 8.0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + mul( true, 5.0 ); // $ExpectError + mul( false, 5.0 ); // $ExpectError + mul( null, 5.0 ); // $ExpectError + mul( undefined, 5.0 ); // $ExpectError + mul( '5', 5.0 ); // $ExpectError + mul( [], 5.0 ); // $ExpectError + mul( {}, 5.0 ); // $ExpectError + mul( ( x: number ): number => x, 5.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + mul( 5.0, true ); // $ExpectError + mul( 5.0, false ); // $ExpectError + mul( 5.0, null ); // $ExpectError + mul( 5.0, undefined ); // $ExpectError + mul( 5.0, '5' ); // $ExpectError + mul( 5.0, [] ); // $ExpectError + mul( 5.0, {} ); // $ExpectError + mul( 5.0, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + mul(); // $ExpectError + mul( 5.0 ); // $ExpectError + mul( 5.0, 5.0, 5.0 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js b/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js new file mode 100644 index 000000000000..4e3f3823830a --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js @@ -0,0 +1,32 @@ +/** +* @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 rand = require( '@stdlib/random/base/discrete-uniform' ); +var mul = require( './../lib' ); + +var x; +var y; +var i; + +for ( i = 0; i < 100; i++ ) { + x = rand( -50, 50 ); + y = rand( -50, 50 ); + console.log( '%d x %d = %d', x, y, mul( x, y ) ); +} diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/lib/index.js b/lib/node_modules/@stdlib/number/float16/base/mul/lib/index.js new file mode 100644 index 000000000000..e4c4b2382765 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/lib/index.js @@ -0,0 +1,52 @@ +/** +* @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'; + +/** +* Multiply two half-precision floating-point numbers. +* +* @module @stdlib/number/float16/base/mul +* +* @example +* var mul = require( '@stdlib/number/float16/base/mul' ); +* +* var v = mul( -1.0, 5.0 ); +* // returns -5.0 +* +* v = mul( 2.0, 5.0 ); +* // returns 10.0 +* +* v = mul( 0.0, 5.0 ); +* // returns 0.0 +* +* v = mul( -0.0, 0.0 ); +* // returns -0.0 +* +* v = mul( NaN, NaN ); +* // returns NaN +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/lib/main.js b/lib/node_modules/@stdlib/number/float16/base/mul/lib/main.js new file mode 100644 index 000000000000..d1a13deb14d6 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/lib/main.js @@ -0,0 +1,62 @@ +/** +* @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 float64ToFloat16 = require( '@stdlib/number/float64/base/to-float16' ); + + +// MAIN // + +/** +* Multiplies two half-precision floating-point numbers `x` and `y`. +* +* @param {number} x - first input value +* @param {number} y - second input value +* @returns {number} result +* +* @example +* var v = mul( -1.0, 5.0 ); +* // returns -5.0 +* +* @example +* var v = mul( 2.0, 5.0 ); +* // returns 10.0 +* +* @example +* var v = mul( 0.0, 5.0 ); +* // returns 0.0 +* +* @example +* var v = mul( -0.0, 0.0 ); +* // returns -0.0 +* +* @example +* var v = mul( NaN, NaN ); +* // returns NaN +*/ +function mul( x, y ) { + return float64ToFloat16( float64ToFloat16( x ) * float64ToFloat16( y ) ); +} + + +// EXPORTS // + +module.exports = mul; diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/package.json b/lib/node_modules/@stdlib/number/float16/base/mul/package.json new file mode 100644 index 000000000000..bf2614d9dd99 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/package.json @@ -0,0 +1,147 @@ +{ + "name": "@stdlib/number/float16/base/mul", + "version": "0.0.0", + "description": "Multiply two half-precision floating-point numbers.", + "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": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "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", + "mathematics", + "math", + "product", + "prod", + "multiply", + "multiplication", + "times", + "number", + "half", + "half-precision", + "float" + ], + "__stdlib__": { + "scaffold": { + "$schema": "math/base@v1.0", + "base_alias": "mul", + "alias": "mul", + "pkg_desc": "perform multiplication", + "desc": "performs multiplication", + "short_desc": "multiplication", + "parameters": [ + { + "name": "x", + "desc": "first input value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "float", + "dtype": "float16" + }, + "domain": [ + { + "min": "-infinity", + "max": "infinity" + } + ], + "rand": { + "prng": "random/base/uniform", + "parameters": [ + -10, + 10 + ] + }, + "example_values": [ + -1.0, + 5.0 + ] + }, + { + "name": "y", + "desc": "second input value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "float", + "dtype": "float16" + }, + "domain": [ + { + "min": "-infinity", + "max": "infinity" + } + ], + "rand": { + "prng": "random/base/uniform", + "parameters": [ + -10, + 10 + ] + }, + "example_values": [ + 5.0, + 2.0 + ] + } + ], + "returns": { + "desc": "result", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "float", + "dtype": "float16" + } + }, + "keywords": [ + "multiplication", + "multiply", + "product" + ], + "extra_keywords": [] + } + } +} diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/test/test.js b/lib/node_modules/@stdlib/number/float16/base/mul/test/test.js new file mode 100644 index 000000000000..302d3b937da4 --- /dev/null +++ b/lib/node_modules/@stdlib/number/float16/base/mul/test/test.js @@ -0,0 +1,83 @@ +/** +* @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 isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); +var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var PINF = require( '@stdlib/constants/float16/pinf' ); +var NINF = require( '@stdlib/constants/float16/ninf' ); +var mul = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mul, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function multiplies two numbers', function test( t ) { + t.strictEqual( mul( -2.0, 4.0 ), -8.0, 'returns expected value' ); + t.strictEqual( mul( 3.0, 0.0 ), 0.0, 'returns expected value' ); + t.strictEqual( mul( 0.0, 5.0 ), 0.0, 'returns expected value' ); + t.strictEqual( mul( -3.0, -3.0 ), 9.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function handles negative zeros', function test( t ) { + t.strictEqual( isPositiveZero( mul( -0.0, -0.0 ) ), true, 'returns expected value' ); + t.strictEqual( isNegativeZero( mul( -0.0, 0.0 ) ), true, 'returns expected value' ); + t.strictEqual( isNegativeZero( mul( 0.0, -0.0 ) ), true, 'returns expected value' ); + t.strictEqual( isPositiveZero( mul( 0.0, 0.0 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function handles infinities', function test( t ) { + t.strictEqual( mul( PINF, 5.0 ), PINF, 'returns expected value' ); + t.strictEqual( mul( 5.0, PINF ), PINF, 'returns expected value' ); + t.strictEqual( mul( PINF, PINF ), PINF, 'returns expected value' ); + + t.strictEqual( mul( NINF, 5.0 ), NINF, 'returns expected value' ); + t.strictEqual( mul( 5.0, NINF ), NINF, 'returns expected value' ); + t.strictEqual( mul( NINF, NINF ), PINF, 'returns expected value' ); + + t.strictEqual( mul( NINF, PINF ), NINF, 'returns expected value' ); + t.strictEqual( mul( PINF, NINF ), NINF, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `NaN`, the function returns `NaN`', function test( t ) { + t.strictEqual( isnan( mul( NaN, 5.0 ) ), true, 'returns expected value' ); + t.strictEqual( isnan( mul( NaN, PINF ) ), true, 'returns expected value' ); + t.strictEqual( isnan( mul( NaN, NINF ) ), true, 'returns expected value' ); + + t.strictEqual( isnan( mul( 5.0, NaN ) ), true, 'returns expected value' ); + t.strictEqual( isnan( mul( PINF, NaN ) ), true, 'returns expected value' ); + t.strictEqual( isnan( mul( NINF, NaN ) ), true, 'returns expected value' ); + + t.strictEqual( isnan( mul( NaN, NaN ) ), true, 'returns expected value' ); + + t.end(); +}); From 30d4221f15925821c4d3df161a7304487471fe40 Mon Sep 17 00:00:00 2001 From: sagar7162 Date: Thu, 25 Dec 2025 20:56:45 +0530 Subject: [PATCH 2/5] fix: minor changes in `package.json` --- 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: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/number/float16/base/mul/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/package.json b/lib/node_modules/@stdlib/number/float16/base/mul/package.json index bf2614d9dd99..8142a8bcc9e9 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/package.json +++ b/lib/node_modules/@stdlib/number/float16/base/mul/package.json @@ -95,8 +95,8 @@ ] }, "example_values": [ - -1.0, - 5.0 + -1, + 5 ] }, { @@ -122,8 +122,8 @@ ] }, "example_values": [ - 5.0, - 2.0 + 5, + 2 ] } ], From 49918d3adf4eef2cab8ea95d78c9d031d7dd2ba8 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 25 Dec 2025 20:56:05 -0800 Subject: [PATCH 3/5] Apply suggestions from code review Signed-off-by: Athan --- .../@stdlib/number/float16/base/mul/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/package.json b/lib/node_modules/@stdlib/number/float16/base/mul/package.json index 8142a8bcc9e9..33a788166ec1 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/package.json +++ b/lib/node_modules/@stdlib/number/float16/base/mul/package.json @@ -68,9 +68,9 @@ "$schema": "math/base@v1.0", "base_alias": "mul", "alias": "mul", - "pkg_desc": "perform multiplication", - "desc": "performs multiplication", - "short_desc": "multiplication", + "pkg_desc": "multiply two half-precision floating-point numbers", + "desc": "multiplies two half-precision floating-point numbers", + "short_desc": "", "parameters": [ { "name": "x", @@ -78,7 +78,7 @@ "type": { "javascript": "number", "jsdoc": "number", - "c": "float", + "c": "stdlib_float16_t", "dtype": "float16" }, "domain": [ @@ -105,7 +105,7 @@ "type": { "javascript": "number", "jsdoc": "number", - "c": "float", + "c": "stdlib_float16_t", "dtype": "float16" }, "domain": [ @@ -132,7 +132,7 @@ "type": { "javascript": "number", "jsdoc": "number", - "c": "float", + "c": "stdlib_float16_t", "dtype": "float16" } }, From cd6bcf9ef448a5ed87637358e2208535bc0bb22b Mon Sep 17 00:00:00 2001 From: sagar7162 Date: Fri, 26 Dec 2025 19:08:10 +0530 Subject: [PATCH 4/5] fix: apply the suggestions --- 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: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../number/float16/base/mul/package.json | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/package.json b/lib/node_modules/@stdlib/number/float16/base/mul/package.json index 33a788166ec1..1db52867c611 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/package.json +++ b/lib/node_modules/@stdlib/number/float16/base/mul/package.json @@ -95,8 +95,26 @@ ] }, "example_values": [ + -10, + -5, + -2, -1, - 5 + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 ] }, { @@ -122,8 +140,26 @@ ] }, "example_values": [ + -5, + -4, + -3, + -2, + -1, + 0, + 1, + 2, + 3, + 4, 5, - 2 + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 ] } ], From 8eba8496156b1416afe9cfc57dad63e6619afd64 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 26 Dec 2025 15:45:16 -0800 Subject: [PATCH 5/5] chore: clean-up --- 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: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - 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: na - task: lint_license_headers status: passed --- --- .../@stdlib/number/float16/base/mul/README.md | 14 +++++--------- .../float16/base/mul/benchmark/benchmark.js | 15 +++++++++------ .../number/float16/base/mul/examples/index.js | 14 +++++--------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/README.md b/lib/node_modules/@stdlib/number/float16/base/mul/README.md index 7b2b354d91bf..1227ce4d5d9f 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/README.md +++ b/lib/node_modules/@stdlib/number/float16/base/mul/README.md @@ -82,18 +82,14 @@ v = mul( NaN, NaN ); ```javascript -var rand = require( '@stdlib/random/base/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); var mul = require( '@stdlib/number/float16/base/mul' ); -var x; -var y; -var i; +var x = discreteUniform( 100, -50, 50 ); +var y = discreteUniform( 100, -50, 50 ); -for ( i = 0; i < 100; i++ ) { - x = rand( -50, 50 ); - y = rand( -50, 50 ); - console.log( '%d x %d = %d', x, y, mul( x, y ) ); -} +logEachMap( '%d x %d = %d', x, y, mul ); ``` diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js b/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js index bbec40fe6299..5bf80538a637 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/number/float16/base/mul/benchmark/benchmark.js @@ -21,8 +21,9 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var mul = require( './../lib' ); @@ -34,10 +35,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = discreteUniform( 100, -100, 100 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = mul( x, 5.0 ); + y = mul( x[ i%x.length ], 5.0 ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -50,15 +52,16 @@ bench( pkg, function benchmark( b ) { b.end(); }); -bench( pkg+'::inline', function benchmark( b ) { +bench( format( '%s::inline', pkg ), function benchmark( b ) { var x; var y; var i; + x = discreteUniform( 100, -100, 100 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = x * 5.0; + y = x[ i%x.length ] * 5.0; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js b/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js index 4e3f3823830a..b4a4b364ac6a 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js +++ b/lib/node_modules/@stdlib/number/float16/base/mul/examples/index.js @@ -18,15 +18,11 @@ 'use strict'; -var rand = require( '@stdlib/random/base/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); var mul = require( './../lib' ); -var x; -var y; -var i; +var x = discreteUniform( 100, -50, 50 ); +var y = discreteUniform( 100, -50, 50 ); -for ( i = 0; i < 100; i++ ) { - x = rand( -50, 50 ); - y = rand( -50, 50 ); - console.log( '%d x %d = %d', x, y, mul( x, y ) ); -} +logEachMap( '%d x %d = %d', x, y, mul );