From fc8571d4e2f7981711a85db47ef8d4acfecfba32 Mon Sep 17 00:00:00 2001 From: Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:49:05 +0530 Subject: [PATCH] feat: add `constants/float32/ln-pi` PR-URL: https://github.com/stdlib-js/stdlib/pull/3342 Closes: https://github.com/stdlib-js/stdlib/issues/3344 Co-authored-by: Athan Reines Reviewed-by: Athan Reines Signed-off-by: Athan Reines Co-authored-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> --- .../@stdlib/constants/float32/ln-pi/README.md | 147 ++++++++++++++++++ .../constants/float32/ln-pi/docs/repl.txt | 13 ++ .../float32/ln-pi/docs/types/index.d.ts | 33 ++++ .../float32/ln-pi/docs/types/test.ts | 28 ++++ .../constants/float32/ln-pi/examples/index.js | 24 +++ .../include/stdlib/constants/float32/ln_pi.h | 27 ++++ .../constants/float32/ln-pi/lib/index.js | 48 ++++++ .../constants/float32/ln-pi/manifest.json | 36 +++++ .../constants/float32/ln-pi/package.json | 70 +++++++++ .../constants/float32/ln-pi/test/test.js | 40 +++++ 10 files changed, 466 insertions(+) create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/README.md create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/examples/index.js create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/include/stdlib/constants/float32/ln_pi.h create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/lib/index.js create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/manifest.json create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/package.json create mode 100644 lib/node_modules/@stdlib/constants/float32/ln-pi/test/test.js diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/README.md b/lib/node_modules/@stdlib/constants/float32/ln-pi/README.md new file mode 100644 index 000000000000..85094b7be3f5 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/README.md @@ -0,0 +1,147 @@ + + +# FLOAT32_LN_PI + +> Natural logarithm of the mathematical constant [π][pi] as a single-precision floating-point number. + +
+ +## Usage + +```javascript +var FLOAT32_LN_PI = require( '@stdlib/constants/float32/ln-pi' ); +``` + +#### FLOAT32_LN_PI + +Natural logarithm of the mathematical constant [π][pi] as a single-precision floating-point number. + +```javascript +var bool = ( FLOAT32_LN_PI === 1.1447298526763916 ); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var FLOAT32_LN_PI = require( '@stdlib/constants/float32/ln-pi' ); + +console.log( FLOAT32_LN_PI ); +// => 1.1447298526763916 +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/constants/float32/ln_pi.h" +``` + +#### STDLIB_CONSTANT_FLOAT32_LN_PI + +Macro for the natural logarithm of the mathematical constant [π][pi] as a single-precision floating-point number. + +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/repl.txt b/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/repl.txt new file mode 100644 index 000000000000..f01d47d95aa8 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/repl.txt @@ -0,0 +1,13 @@ + +{{alias}} + Natural logarithm of the mathematical constant `π` as a single-precision + floating-point number. + + Examples + -------- + > {{alias}} + 1.1447298526763916 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/index.d.ts new file mode 100644 index 000000000000..ab3f0a481d5c --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/index.d.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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 mathematical constant `π` as a single-precision floating-point number. +* +* @example +* var val = FLOAT32_LN_PI; +* // returns 1.1447298526763916 +*/ +declare const FLOAT32_LN_PI: number; + + +// EXPORTS // + +export = FLOAT32_LN_PI; diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/test.ts new file mode 100644 index 000000000000..e94676402fdf --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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_LN_PI = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT32_LN_PI; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/examples/index.js b/lib/node_modules/@stdlib/constants/float32/ln-pi/examples/index.js new file mode 100644 index 000000000000..5f9fe4912c4b --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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_LN_PI = require( './../lib' ); + +console.log( FLOAT32_LN_PI ); +// => 1.1447298526763916 diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/include/stdlib/constants/float32/ln_pi.h b/lib/node_modules/@stdlib/constants/float32/ln-pi/include/stdlib/constants/float32/ln_pi.h new file mode 100644 index 000000000000..363cb27b0fb7 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/include/stdlib/constants/float32/ln_pi.h @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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_LN_PI_H +#define STDLIB_CONSTANTS_FLOAT32_LN_PI_H + +/** +* Macro for the natural logarithm of π as a single-precision floating-point number. +*/ +#define STDLIB_CONSTANT_FLOAT32_LN_PI 1.1447298526763916f + +#endif // !STDLIB_CONSTANTS_FLOAT32_LN_PI_H diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/lib/index.js b/lib/node_modules/@stdlib/constants/float32/ln-pi/lib/index.js new file mode 100644 index 000000000000..572108c080c9 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/lib/index.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 mathematical constant `π` as a single-precision floating-point number. +* +* @module @stdlib/constants/float32/ln-pi +* @type {number} +* +* @example +* var FLOAT32_LN_PI = require( '@stdlib/constants/float32/ln-pi' ); +* // returns 1.1447298526763916 +*/ + + +// MAIN // + +/** +* Natural logarithm of the mathematical constant `π` as a single-precision floating-point number. +* +* @constant +* @type {number} +* @default 1.1447298526763916 +* @see [Wikipedia]{@link https://en.wikipedia.org/wiki/Pi} +*/ +var FLOAT32_LN_PI = 1.1447298526763916; + + +// EXPORTS // + +module.exports = FLOAT32_LN_PI; diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/manifest.json b/lib/node_modules/@stdlib/constants/float32/ln-pi/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/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/ln-pi/package.json b/lib/node_modules/@stdlib/constants/float32/ln-pi/package.json new file mode 100644 index 000000000000..b277e09655d7 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/constants/float32/ln-pi", + "version": "0.0.0", + "description": "Natural logarithm of π as a single-precision floating-point number", + "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", + "natural", + "logarithm", + "log", + "lnpi", + "logpi", + "pi", + "ieee754", + "float", + "single", + "floating-point", + "float32" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float32/ln-pi/test/test.js b/lib/node_modules/@stdlib/constants/float32/ln-pi/test/test.js new file mode 100644 index 000000000000..19ef6a6f9fe9 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/ln-pi/test/test.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 PI = require( '@stdlib/constants/float32/pi' ); +var LN_PI = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof LN_PI, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'export is a single-precision floating-point number equal to 1.1447298526763916', function test( t ) { + t.equal( LN_PI, lnf(PI), 'equals 1.1447298526763916' ); + t.end(); +});