From d5c83c06bff8491d0994009bba44c6484de1fa79 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Thu, 20 Mar 2025 00:59:39 +0530 Subject: [PATCH 1/3] feat: add JS implementation --- .../constants/float32/eulergamma/README.md | 156 ++++++++++++++++++ .../docs/img/equation_eulergamma_constant.svg | 64 +++++++ .../float32/eulergamma/docs/repl.txt | 12 ++ .../float32/eulergamma/docs/types/index.d.ts | 33 ++++ .../float32/eulergamma/docs/types/test.ts | 28 ++++ .../float32/eulergamma/examples/index.js | 24 +++ .../stdlib/constants/float32/eulergamma.h | 27 +++ .../constants/float32/eulergamma/lib/index.js | 53 ++++++ .../float32/eulergamma/manifest.json | 36 ++++ .../constants/float32/eulergamma/package.json | 71 ++++++++ .../constants/float32/eulergamma/test/test.js | 38 +++++ 11 files changed, 542 insertions(+) create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/README.md create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/docs/img/equation_eulergamma_constant.svg create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/include/stdlib/constants/float32/eulergamma.h create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/manifest.json create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/package.json create mode 100644 lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/README.md b/lib/node_modules/@stdlib/constants/float32/eulergamma/README.md new file mode 100644 index 000000000000..9b0a00a805e5 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/README.md @@ -0,0 +1,156 @@ + + +# FLOAT32_EULERGAMMA + +> The [Euler-Mascheroni][eulergamma] constant. + +
+ +The [Euler-Mascheroni][eulergamma] constant `gamma` (also known as "Euler's constant" or "the Euler constant") is defined as the limit of the sequence + + + +```math +\gamma = \lim_{n\to\infty} \left( \sum_{k=1}^n \frac{1}{k} - \ln n \right) +``` + + + + + +
+ + + +
+ +## Usage + +```javascript +var FLOAT32_EULERGAMMA = require( '@stdlib/constants/float32/eulergamma' ); +``` + +#### FLOAT32_EULERGAMMA + +The [Euler-Mascheroni][eulergamma] constant. + +```javascript +var bool = ( FLOAT32_EULERGAMMA === 0.5772156715393066 ); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var FLOAT32_EULERGAMMA = require( '@stdlib/constants/float32/eulergamma' ); + +console.log( FLOAT32_EULERGAMMA ); +// => 0.5772156715393066 +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/constants/float32/eulergamma.h" +``` + +#### STDLIB_CONSTANT_FLOAT32_EULERGAMMA + +Macro for the [Euler-Mascheroni][eulergamma] constant. + +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/img/equation_eulergamma_constant.svg b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/img/equation_eulergamma_constant.svg new file mode 100644 index 000000000000..26ceed1c4f80 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/img/equation_eulergamma_constant.svg @@ -0,0 +1,64 @@ + +gamma equals limit Underscript n right-arrow normal infinity Endscripts left-parenthesis sigma-summation Underscript k equals 1 Overscript n Endscripts StartFraction 1 Over k EndFraction minus ln n right-parenthesis + + + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/repl.txt b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/repl.txt new file mode 100644 index 000000000000..96f92f639f57 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/repl.txt @@ -0,0 +1,12 @@ + +{{alias}} + The Euler-Mascheroni constant. + + Examples + -------- + > {{alias}} + 0.5772156715393066 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts new file mode 100644 index 000000000000..48816d7e1d21 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/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 + +/** +* The Euler-Mascheroni constant. +* +* @example +* var val = FLOAT32_GAMMA; +* // returns 0.5772156715393066 +*/ +declare const FLOAT32_GAMMA: number; + + +// EXPORTS // + +export = FLOAT32_GAMMA; diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts new file mode 100644 index 000000000000..fa10e77a9c52 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/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 FLOAT32_GAMMA = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT32_GAMMA; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js b/lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js new file mode 100644 index 000000000000..faf40e0b44e3 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/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 FLOAT32_GAMMA = require( './../lib' ); + +console.log( FLOAT32_GAMMA ); +// => 0.5772156715393066 diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/include/stdlib/constants/float32/eulergamma.h b/lib/node_modules/@stdlib/constants/float32/eulergamma/include/stdlib/constants/float32/eulergamma.h new file mode 100644 index 000000000000..82168e8ebcb9 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/include/stdlib/constants/float32/eulergamma.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_FLOAT32_EULERGAMMA_H +#define STDLIB_CONSTANTS_FLOAT32_EULERGAMMA_H + +/** +* Macro for the Euler-Mascheroni constant. +*/ +#define STDLIB_CONSTANT_FLOAT32_EULERGAMMA 0.5772156649015328606f + +#endif // !STDLIB_CONSTANTS_FLOAT32_EULERGAMMA_H diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js b/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js new file mode 100644 index 000000000000..ad10699c749c --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js @@ -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. +*/ + +'use strict'; + +/** +* The Euler-Mascheroni constant. +* +* @module @stdlib/constants/float32/eulergamma +* @type {number} +* +* @example +* var FLOAT32_GAMMA = require( '@stdlib/constants/float32/eulergamma' ); +* // returns 0.5772156715393066 +*/ + +// MODULES // + +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* The Euler-Mascheroni constant. +* +* @constant +* @type {number} +* @default 0.5772156715393066 +* @see [OEIS]{@link http://oeis.org/A001620} +* @see [Mathworld]{@link http://mathworld.wolfram.com/Euler-MascheroniConstant.html} +*/ +var FLOAT32_GAMMA = float64ToFloat32( 0.5772156649015329 ); + + +// EXPORTS // + +module.exports = FLOAT32_GAMMA; diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/manifest.json b/lib/node_modules/@stdlib/constants/float32/eulergamma/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/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/float32/eulergamma/package.json b/lib/node_modules/@stdlib/constants/float32/eulergamma/package.json new file mode 100644 index 000000000000..a7f0db200bc8 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/constants/float32/eulergamma", + "version": "0.0.0", + "description": "The Euler-Mascheroni constant.", + "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", + "mathematics", + "math", + "euler", + "euler-mascheroni", + "mascheroni", + "eulers constant", + "euler constant", + "gamma", + "eulergamma", + "ieee754", + "precision", + "floating-point", + "float", + "float32" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js b/lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js new file mode 100644 index 000000000000..9602fba98cae --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/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 FLOAT32_GAMMA = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof FLOAT32_GAMMA, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'the exported value is a single-precision floating-point number equal to 0.5772156715393066', function test( t ) { + t.equal( FLOAT32_GAMMA, 0.5772156715393066, 'returns 0.5772156715393066' ); + t.end(); +}); From 1a87896df80937e2bc2aec6a001830f7b72acee5 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Thu, 20 Mar 2025 09:08:49 +0530 Subject: [PATCH 2/3] chore: refactor var --- .../constants/float32/eulergamma/docs/types/index.d.ts | 4 ++-- .../@stdlib/constants/float32/eulergamma/docs/types/test.ts | 4 ++-- .../@stdlib/constants/float32/eulergamma/examples/index.js | 4 ++-- .../@stdlib/constants/float32/eulergamma/lib/index.js | 6 +++--- .../@stdlib/constants/float32/eulergamma/test/test.js | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts index 48816d7e1d21..955c8425534d 100644 --- a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts @@ -25,9 +25,9 @@ * var val = FLOAT32_GAMMA; * // returns 0.5772156715393066 */ -declare const FLOAT32_GAMMA: number; +declare const FLOAT32_EULERGAMMA: number; // EXPORTS // -export = FLOAT32_GAMMA; +export = FLOAT32_EULERGAMMA; diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts index fa10e77a9c52..27135c947aeb 100644 --- a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/test.ts @@ -16,7 +16,7 @@ * limitations under the License. */ -import FLOAT32_GAMMA = require( './index' ); +import FLOAT32_EULERGAMMA = require( './index' ); // TESTS // @@ -24,5 +24,5 @@ import FLOAT32_GAMMA = require( './index' ); // The export is a number... { // eslint-disable-next-line @typescript-eslint/no-unused-expressions - FLOAT32_GAMMA; // $ExpectType number + FLOAT32_EULERGAMMA; // $ExpectType number } diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js b/lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js index faf40e0b44e3..36edece94b72 100644 --- a/lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/examples/index.js @@ -18,7 +18,7 @@ 'use strict'; -var FLOAT32_GAMMA = require( './../lib' ); +var FLOAT32_EULERGAMMA = require( './../lib' ); -console.log( FLOAT32_GAMMA ); +console.log( FLOAT32_EULERGAMMA ); // => 0.5772156715393066 diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js b/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js index ad10699c749c..ffab2b99cac8 100644 --- a/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/lib/index.js @@ -25,7 +25,7 @@ * @type {number} * * @example -* var FLOAT32_GAMMA = require( '@stdlib/constants/float32/eulergamma' ); +* var FLOAT32_EULERGAMMA = require( '@stdlib/constants/float32/eulergamma' ); * // returns 0.5772156715393066 */ @@ -45,9 +45,9 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); * @see [OEIS]{@link http://oeis.org/A001620} * @see [Mathworld]{@link http://mathworld.wolfram.com/Euler-MascheroniConstant.html} */ -var FLOAT32_GAMMA = float64ToFloat32( 0.5772156649015329 ); +var FLOAT32_EULERGAMMA = float64ToFloat32( 0.5772156649015329 ); // EXPORTS // -module.exports = FLOAT32_GAMMA; +module.exports = FLOAT32_EULERGAMMA; diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js b/lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js index 9602fba98cae..191b3eb318ae 100644 --- a/lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/test/test.js @@ -21,18 +21,18 @@ // MODULES // var tape = require( 'tape' ); -var FLOAT32_GAMMA = require( './../lib' ); +var FLOAT32_EULERGAMMA = require( './../lib' ); // TESTS // tape( 'main export is a number', function test( t ) { t.ok( true, __filename ); - t.strictEqual( typeof FLOAT32_GAMMA, 'number', 'main export is a number' ); + t.strictEqual( typeof FLOAT32_EULERGAMMA, 'number', 'main export is a number' ); t.end(); }); tape( 'the exported value is a single-precision floating-point number equal to 0.5772156715393066', function test( t ) { - t.equal( FLOAT32_GAMMA, 0.5772156715393066, 'returns 0.5772156715393066' ); + t.equal( FLOAT32_EULERGAMMA, 0.5772156715393066, 'returns 0.5772156715393066' ); t.end(); }); From db8e4019c6973666a717e2c6c114ee50ec2adbca Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 1 Apr 2025 22:39:01 -0700 Subject: [PATCH 3/3] docs: fix variable name Signed-off-by: Athan --- .../@stdlib/constants/float32/eulergamma/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts index 955c8425534d..b1be7ca4acb5 100644 --- a/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/constants/float32/eulergamma/docs/types/index.d.ts @@ -22,7 +22,7 @@ * The Euler-Mascheroni constant. * * @example -* var val = FLOAT32_GAMMA; +* var val = FLOAT32_EULERGAMMA; * // returns 0.5772156715393066 */ declare const FLOAT32_EULERGAMMA: number;