From 80c6886b88ae73f43d5196d3b252cbacd7cf60aa Mon Sep 17 00:00:00 2001 From: Piyush Date: Mon, 22 Dec 2025 21:01:09 +0530 Subject: [PATCH] feat: add constants/float16/sqrt-phi --- 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 --- --- .../constants/float16/sqrt-phi/README.md | 136 ++++++++++++++++++ .../constants/float16/sqrt-phi/docs/repl.txt | 12 ++ .../float16/sqrt-phi/docs/types/index.d.ts | 33 +++++ .../float16/sqrt-phi/docs/types/test.ts | 28 ++++ .../float16/sqrt-phi/examples/index.js | 24 ++++ .../stdlib/constants/float32/sqrt_phi.h | 27 ++++ .../constants/float16/sqrt-phi/lib/index.js | 49 +++++++ .../constants/float16/sqrt-phi/manifest.json | 36 +++++ .../constants/float16/sqrt-phi/package.json | 78 ++++++++++ .../constants/float16/sqrt-phi/test/test.js | 46 ++++++ 10 files changed, 469 insertions(+) create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/README.md create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/examples/index.js create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/include/stdlib/constants/float32/sqrt_phi.h create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/lib/index.js create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/manifest.json create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/package.json create mode 100644 lib/node_modules/@stdlib/constants/float16/sqrt-phi/test/test.js diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/README.md b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/README.md new file mode 100644 index 000000000000..43f51d5789de --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/README.md @@ -0,0 +1,136 @@ + + +# FLOAT16_SQRT_PHI + +> Square root of the [Golden ratio][@stdlib/constants/float64/phi] (φ) as a half-precision floating-point number. + +
+ +## Usage + +```javascript +var FLOAT16_SQRT_PHI = require( '@stdlib/constants/float16/sqrt-phi' ); +``` + +#### FLOAT16_SQRT_PHI + +Square root of the [golden ratio][@stdlib/constants/float64/phi] as a half-precision floating-point number. + +```javascript +var bool = ( FLOAT16_SQRT_PHI === 1.2724609375 ); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var FLOAT16_SQRT_PHI = require( '@stdlib/constants/float16/sqrt-phi' ); + +console.log( FLOAT16_SQRT_PHI ); +// => 1.2724609375 +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/constants/float16/sqrt_phi.h" +``` + +#### STDLIB_CONSTANT_FLOAT16_SQRT_PHI + +Macro for the square root of the [golden ratio][@stdlib/constants/float64/phi] as a half-precision floating-point number. + +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/repl.txt b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/repl.txt new file mode 100644 index 000000000000..8e582ed4e24b --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/repl.txt @@ -0,0 +1,12 @@ + +{{alias}} + Square root of the golden ratio as a half-precision floating-point number. + + Examples + -------- + > {{alias}} + 1.2724609375 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/types/index.d.ts new file mode 100644 index 000000000000..c104fa560704 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/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 + +/** +* Square root of the golden ratio as a half-precision floating-point number. +* +* @example +* var val = FLOAT16_SQRT_PHI; +* // returns 1.2724609375 +*/ +declare const FLOAT16_SQRT_PHI: number; + + +// EXPORTS // + +export = FLOAT16_SQRT_PHI; diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/docs/types/test.ts new file mode 100644 index 000000000000..abba2fbfa7a1 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/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_SQRT_PHI = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT16_SQRT_PHI; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/examples/index.js b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/examples/index.js new file mode 100644 index 000000000000..e4beb1d3d63a --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/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_SQRT_PHI = require( './../lib' ); + +console.log( FLOAT16_SQRT_PHI ); +// => 1.2724609375 diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/include/stdlib/constants/float32/sqrt_phi.h b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/include/stdlib/constants/float32/sqrt_phi.h new file mode 100644 index 000000000000..ea144e5d92d8 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/include/stdlib/constants/float32/sqrt_phi.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_FLOAT16_SQRT_PHI_H +#define STDLIB_CONSTANTS_FLOAT16_SQRT_PHI_H + +/** +* Macro for the square root of the golden ratio as a half-precision floating-point number. +*/ +#define STDLIB_CONSTANT_FLOAT16_SQRT_PHI 1.2724609375f + +#endif // !STDLIB_CONSTANTS_FLOAT16_SQRT_PHI_H diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/lib/index.js b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/lib/index.js new file mode 100644 index 000000000000..c6cc3fd5c57b --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/lib/index.js @@ -0,0 +1,49 @@ +/** +* @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'; + +/** +* Square root of the golden ratio as a half-precision floating-point number. +* +* @module @stdlib/constants/float16/sqrt-phi +* @type {number} +* +* @example +* var FLOAT16_SQRT_PHI = require( '@stdlib/constants/float16/sqrt-phi' ); +* // returns 1.2724609375 +*/ + + +// MAIN // + +/** +* Square root of the golden ratio as a half-precision floating-point number. +* +* @constant +* @type {number} +* @default 1.2724609375 +* @see [OEIS]{@link http://oeis.org/A139339} +* @see [Wikipedia]{@link https://en.wikipedia.org/wiki/Golden_ratio} +*/ +var FLOAT16_SQRT_PHI = 1.2724609375; + + +// EXPORTS // + +module.exports = FLOAT16_SQRT_PHI; diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/manifest.json b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/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/float16/sqrt-phi/package.json b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/package.json new file mode 100644 index 000000000000..4109bcc53d12 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/package.json @@ -0,0 +1,78 @@ +{ + "name": "@stdlib/constants/float16/sqrt-phi", + "version": "0.0.0", + "description": "Square root of the golden ratio as a half-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", + "golden", + "ratio", + "phi", + "golden mean", + "golden section", + "divine section", + "golden cut", + "medial section", + "divine proportion", + "golden number", + "number", + "divine", + "ieee754", + "half", + "floating-point", + "float16", + "sqrt", + "square", + "root" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float16/sqrt-phi/test/test.js b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/test/test.js new file mode 100644 index 000000000000..abf7cf6628b3 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float16/sqrt-phi/test/test.js @@ -0,0 +1,46 @@ +/** +* @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 sqrt = require( '@stdlib/math/base/special/sqrt' ); +var PHI = require( '@stdlib/constants/float64/phi' ); +var toFloat16 = require( '@stdlib/number/float64/base/to-float16' ); +var FLOAT16_SQRT_PHI = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof FLOAT16_SQRT_PHI, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'export is a half-precision floating-point number equal to 1.2724609375', function test( t ) { + t.strictEqual( FLOAT16_SQRT_PHI, 1.2724609375, 'returns expected value' ); + t.end(); +}); + +tape( 'the exported value equals to_float16(sqrt(φ))', function test( t ) { + t.strictEqual( FLOAT16_SQRT_PHI, toFloat16( sqrt( PHI ) ), 'returns expected value' ); + t.end(); +});