From e2025ae447954bb6100fc069d038040c72b26867 Mon Sep 17 00:00:00 2001 From: DivyanshuVorrtex Date: Thu, 11 Dec 2025 17:59:38 +0000 Subject: [PATCH 1/2] feat: adding the value of ln-sqrt-two-pi for float16 --- 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 --- --- .../float16/ln-sqrt-two-pi/README.md | 85 +++++++++++++++++++ .../float16/ln-sqrt-two-pi/docs/repl.txt | 12 +++ .../ln-sqrt-two-pi/docs/types/index.d.ts | 33 +++++++ .../float16/ln-sqrt-two-pi/docs/types/test.ts | 28 ++++++ .../float16/ln-sqrt-two-pi/examples/index.js | 24 ++++++ .../float16/ln-sqrt-two-pi/lib/index.js | 55 ++++++++++++ .../float16/ln-sqrt-two-pi/package.json | 72 ++++++++++++++++ .../float16/ln-sqrt-two-pi/test/test.js | 58 +++++++++++++ 8 files changed, 367 insertions(+) create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/examples/index.js create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/package.json create mode 100644 lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/test/test.js diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md new file mode 100644 index 000000000000..87ab67e775b8 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md @@ -0,0 +1,85 @@ + + +# FLOAT16_LN_SQRT_TWO_PI + +> [Natural logarithm][@stdlib/math/base/special/lnf] of the [square root][@stdlib/math/base/special/sqrtf] of [2π][@stdlib/constants/float16/pi]. + +
+ +## Usage + +```javascript +var FLOAT16_LN_SQRT_TWO_PI = require( '@stdlib/constants/float16/ln-sqrt-two-pi' ); +``` + +#### FLOAT16_LN_SQRT_TWO_PI + +[Natural logarithm][@stdlib/math/base/special/lnf] of the [square root][@stdlib/math/base/special/sqrtf] of [2π][@stdlib/constants/float16/pi]. + +```javascript +var bool = ( FLOAT16_LN_SQRT_TWO_PI === 0.9189453125 ); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var FLOAT16_LN_SQRT_TWO_PI = require( '@stdlib/constants/float16/ln-sqrt-two-pi' ); + +console.log( FLOAT16_LN_SQRT_TWO_PI ); +// => 0.9189453125 +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/repl.txt b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/repl.txt new file mode 100644 index 000000000000..365f43a6c467 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/repl.txt @@ -0,0 +1,12 @@ + +{{alias}} + Natural logarithm of the square root of `2π`. + + Examples + -------- + > {{alias}} + 0.9189453125 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/types/index.d.ts new file mode 100644 index 000000000000..53e75ee3307a --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/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 + +/** +* Natural logarithm of the square root of `2π`. +* +* @example +* var val = FLOAT16_LN_SQRT_TWO_PI; +* // returns 0.9189453125 +*/ +declare const FLOAT16_LN_SQRT_TWO_PI: number; + + +// EXPORTS // + +export = FLOAT16_LN_SQRT_TWO_PI; diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/docs/types/test.ts new file mode 100644 index 000000000000..37add3a714c0 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/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_LN_SQRT_TWO_PI = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT16_LN_SQRT_TWO_PI; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/examples/index.js b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/examples/index.js new file mode 100644 index 000000000000..7975a8c59678 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/examples/index.js @@ -0,0 +1,24 @@ +/** +* @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_LN_SQRT_TWO_PI = require( './../lib' ); + +console.log( FLOAT16_LN_SQRT_TWO_PI ); +// => 0.9189453125 diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js new file mode 100644 index 000000000000..c23c77d91aa8 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js @@ -0,0 +1,55 @@ +/** +* @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'; + +/** +* Natural logarithm of the square root of `2π`. +* +* @module @stdlib/constants/float16/ln-sqrt-two-pi +* @type {number} +* +* @example +* var FLOAT16_LN_SQRT_TWO_PI = require( '@stdlib/constants/float16/ln-sqrt-two-pi' ); +* // returns 0.9189453125 +*/ + +// MODULES // + +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float16' ); + + +// MAIN // + +/** +* Natural logarithm of the square root of `2π`. +* +* ```tex +* \ln \sqrt{2\pi} +* ``` +* +* @constant +* @type {number} +* @default 0.9189453125 +*/ +var FLOAT16_LN_SQRT_TWO_PI = float64ToFloat32( 0.9189385332046728 ); + + +// EXPORTS // + +module.exports = FLOAT16_LN_SQRT_TWO_PI; diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/package.json b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/package.json new file mode 100644 index 000000000000..078aef2f41dd --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/constants/float16/ln-sqrt-two-pi", + "version": "0.0.0", + "description": "Natural logarithm of the square root of 2π.", + "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", + "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", + "mathematics", + "math", + "pi", + "2pi", + "sqrt", + "ln", + "natural", + "logarithm", + "log", + "square", + "root", + "ieee754", + "precision", + "floating-point", + "float", + "float16" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/test/test.js b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/test/test.js new file mode 100644 index 000000000000..434c8ffa3e7c --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/test/test.js @@ -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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var lnf = require( '@stdlib/math/base/special/lnf' ); +var sqrtf = require( '@stdlib/math/base/special/sqrtf' ); +var absf = require( '@stdlib/math/base/special/absf' ); +var FLOAT16_TWO_PI = require( '@stdlib/constants/float16/two-pi' ); +var EPS = require( '@stdlib/constants/float16/eps' ); +var FLOAT16_LN_SQRT_TWO_PI = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof FLOAT16_LN_SQRT_TWO_PI, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'export is a half-precision floating-point number equal to 0.9189453125', function test( t ) { + t.strictEqual( FLOAT16_LN_SQRT_TWO_PI, 0.9189453125, 'returns expected value' ); + t.end(); +}); + +tape( 'export equals ln(sqrt(2π))', function test( t ) { + var delta; + var tol; + var v; + + v = lnf( sqrtf( FLOAT16_TWO_PI ) ); + + delta = absf( v - FLOAT16_LN_SQRT_TWO_PI ); + tol = EPS * FLOAT16_LN_SQRT_TWO_PI; + + t.ok( delta <= tol, 'equals ln(sqrt(2π)) within tolerance '+tol ); + + t.end(); +}); From fcd491ea6ca4e6658e7abd7f7c9ba7fa322eb498 Mon Sep 17 00:00:00 2001 From: DivyanshuVorrtex Date: Sat, 13 Dec 2025 08:51:06 +0000 Subject: [PATCH 2/2] feat: fix the working of ln-sqrt-two-pi --- 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: 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/constants/float16/ln-sqrt-two-pi/README.md | 10 ++-------- .../constants/float16/ln-sqrt-two-pi/lib/index.js | 6 +----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md index 87ab67e775b8..e364488b92d0 100644 --- a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/README.md @@ -20,7 +20,7 @@ limitations under the License. # FLOAT16_LN_SQRT_TWO_PI -> [Natural logarithm][@stdlib/math/base/special/lnf] of the [square root][@stdlib/math/base/special/sqrtf] of [2π][@stdlib/constants/float16/pi]. +> Natural logarithm of the square root of 2π.
@@ -32,7 +32,7 @@ var FLOAT16_LN_SQRT_TWO_PI = require( '@stdlib/constants/float16/ln-sqrt-two-pi' #### FLOAT16_LN_SQRT_TWO_PI -[Natural logarithm][@stdlib/math/base/special/lnf] of the [square root][@stdlib/math/base/special/sqrtf] of [2π][@stdlib/constants/float16/pi]. +Natural logarithm of the square root of 2π. ```javascript var bool = ( FLOAT16_LN_SQRT_TWO_PI === 0.9189453125 ); @@ -74,12 +74,6 @@ console.log( FLOAT16_LN_SQRT_TWO_PI ); diff --git a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js index c23c77d91aa8..d088f1fae443 100644 --- a/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js +++ b/lib/node_modules/@stdlib/constants/float16/ln-sqrt-two-pi/lib/index.js @@ -29,10 +29,6 @@ * // returns 0.9189453125 */ -// MODULES // - -var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float16' ); - // MAIN // @@ -47,7 +43,7 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float16' ); * @type {number} * @default 0.9189453125 */ -var FLOAT16_LN_SQRT_TWO_PI = float64ToFloat32( 0.9189385332046728 ); +var FLOAT16_LN_SQRT_TWO_PI = 0.9189453125; // EXPORTS //