From 9b0674ccd2aff579acba91934ec382c521fd250b Mon Sep 17 00:00:00 2001 From: Manvith <148960168+manvith2003@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:37:52 +0530 Subject: [PATCH 1/4] feat: add constants/float32/sqrt-three --- .../constants/float32/sqrt-three/README.md | 135 ++++++++++++++++++ .../float32/sqrt-three/docs/repl.txt | 12 ++ .../float32/sqrt-three/docs/types/index.d.ts | 33 +++++ .../float32/sqrt-three/docs/types/test.ts | 28 ++++ .../float32/sqrt-three/examples/index.js | 24 ++++ .../stdlib/constants/float64/sqrt_three.h | 27 ++++ .../constants/float32/sqrt-three/lib/index.js | 51 +++++++ .../float32/sqrt-three/manifest.json | 36 +++++ .../constants/float32/sqrt-three/package.json | 69 +++++++++ .../constants/float32/sqrt-three/test/test.js | 56 ++++++++ 10 files changed, 471 insertions(+) create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/examples/index.js create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/lib/index.js create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/manifest.json create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json create mode 100644 lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md new file mode 100644 index 000000000000..060e2c002b4f --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md @@ -0,0 +1,135 @@ + + +# FLOAT32_SQRT3 + +> [Square root][@stdlib/math/base/special/sqrt] of `3` as a single-precision floating-point number. + +
+ +## Usage + +```javascript +var FLOAT32_SQRT3 = require( '@stdlib/constants/float32/sqrt-three' ); +``` + +#### FLOAT32_SQRT3 + +[Square root][@stdlib/math/base/special/sqrt] of `3` as a single-precision floating-point number. + +```javascript +var bool = ( FLOAT32_SQRT3 === 1.7320507764816284); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var FLAOT32_SQRT3 = require( '@stdlib/constants/float32/sqrt-three' ); + +console.log( FLOAT32_SQRT3 ); +// => 1.7320507764816284 +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/constants/float32/sqrt_three.h" +``` + +#### STDLIB_CONSTANT_FLOAT32_SQRT3 + +Macro for the [square root][@stdlib/math/base/special/sqrt] of `3`. + +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/repl.txt b/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/repl.txt new file mode 100644 index 000000000000..3ae7d62a7ad6 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/repl.txt @@ -0,0 +1,12 @@ + +{{alias}} + Square root of `3` as a single-precision floating-point number. + + Examples + -------- + > {{alias}} + 1.7320507764816284 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/types/index.d.ts b/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/types/index.d.ts new file mode 100644 index 000000000000..ee4306d3e1d5 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/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 + +/** +* Square root of `3` as a single-precision floating-point number. +* +* @example +* var val = FLOAT32_SQRT3; +* // returns 1.7320507764816284 +*/ +declare const FLOAT32_SQRT3: number; + + +// EXPORTS // + +export = FLOAT32_SQRT3; diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/types/test.ts b/lib/node_modules/@stdlib/constants/float32/sqrt-three/docs/types/test.ts new file mode 100644 index 000000000000..816715e09894 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/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_SQRT3 = require( './index' ); + + +// TESTS // + +// The export is a number... +{ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + FLOAT32_SQRT3; // $ExpectType number +} diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/examples/index.js b/lib/node_modules/@stdlib/constants/float32/sqrt-three/examples/index.js new file mode 100644 index 000000000000..c2586f1ad937 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/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_SQRT3 = require( './../lib' ); + +console.log( FLOAT32_SQRT3 ); +// => 1.7320507764816284 diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h b/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h new file mode 100644 index 000000000000..4fcb1d098ddb --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.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_SQRT_THREE_H +#define STDLIB_CONSTANTS_FLOAT32_SQRT_THREE_H + +/** +* Macro for the square root of 3 as a single-precision floating-point number. +*/ +#define STDLIB_CONSTANT_FLOAT32_SQRT3 1.7320507764816284 + +#endif // !STDLIB_CONSTANTS_FLOAT32_SQRT_THREE_H diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/lib/index.js b/lib/node_modules/@stdlib/constants/float32/sqrt-three/lib/index.js new file mode 100644 index 000000000000..30f8c0c905a0 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/lib/index.js @@ -0,0 +1,51 @@ +/** +* @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'; + +/** +* Square root of `3` as a single-precision floating-point number. +* +* @module @stdlib/constants/float32/sqrt-three +* @type {number} +* +* @example +* var FLOAT32_SQRT3 = require( '@stdlib/constants/float32/sqrt-three' ); +* // returns 1.7320507764816284 +*/ + + +// MAIN // + +/** +* Square root of `3` as a single-precision floating-point number. +* +* ```tex +* \sqrt{3} +* ``` +* +* @constant +* @type {number} +* @default 1.7320507764816284 +*/ +var FLOAT32_SQRT3 = 1.7320507764816284; + + +// EXPORTS // + +module.exports = FLOAT32_SQRT3; diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/manifest.json b/lib/node_modules/@stdlib/constants/float32/sqrt-three/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/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/sqrt-three/package.json b/lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json new file mode 100644 index 000000000000..71e11746c2e6 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/constants/float64/sqrt-three", + "version": "0.0.0", + "description": "Square root of 3.", + "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", + "sqrt", + "square", + "root", + "three", + "sqrt3", + "ieee754", + "double", + "dbl", + "floating-point", + "float64" + ] +} diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js b/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js new file mode 100644 index 000000000000..7e326ec4f424 --- /dev/null +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js @@ -0,0 +1,56 @@ +/** +* @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 sqrt = require( '@stdlib/math/base/special/sqrt' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var absf = require( '@stdlib/math/base/special/absf' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var FLOAT32_SQRT3 = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a number', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof FLOAT32_SQRT3, 'number', 'main export is a number' ); + t.end(); +}); + +tape( 'the exported value is a single-precision floating-point number equal to the square root of 3', function test( t ) { + t.equal( FLOAT32_SQRT3, float64ToFloat32( sqrt( 3 ) ), 'equals sqrt(3)' ); + t.end(); +}); + +tape( 'export equals `sqrt(3)`', function test( t ) { + var delta; + var tol; + var v; + + v = sqrt( 3.0 ); + delta = absf( float64ToFloat32( v - FLOAT32_SQRT3 ) ); + tol = EPS * FLOAT32_SQRT3; + + t.ok( delta <= tol, 'equals sqrt(3) within tolerance '+tol ); + + t.end(); +}); From e78acc54412b22f881fc2ddee365899a500b81b7 Mon Sep 17 00:00:00 2001 From: Manvith <148960168+manvith2003@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:25:07 +0530 Subject: [PATCH 2/4] feat: add constants/float32/sqrt-three --- lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md index 060e2c002b4f..6c26a08498d1 100644 --- a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md @@ -52,7 +52,7 @@ var bool = ( FLOAT32_SQRT3 === 1.7320507764816284); ```javascript -var FLAOT32_SQRT3 = require( '@stdlib/constants/float32/sqrt-three' ); +var FLOAT32_SQRT3 = require( '@stdlib/constants/float32/sqrt-three' ); console.log( FLOAT32_SQRT3 ); // => 1.7320507764816284 From df10e1f026ab754ec83a87e5683780d4580ea750 Mon Sep 17 00:00:00 2001 From: Manvith <148960168+manvith2003@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:32:31 +0530 Subject: [PATCH 3/4] docs: fixed styling --- .../constants/float32/sqrt-three/README.md | 10 +++++----- .../stdlib/constants/float64/sqrt_three.h | 2 +- .../constants/float32/sqrt-three/package.json | 9 ++++----- .../constants/float32/sqrt-three/test/test.js | 20 ++----------------- 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md index 6c26a08498d1..365148cfe677 100644 --- a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md @@ -20,7 +20,7 @@ limitations under the License. # FLOAT32_SQRT3 -> [Square root][@stdlib/math/base/special/sqrt] of `3` as a single-precision floating-point number. +> [Square root][@stdlib/math/base/special/sqrtf] of `3` as a single-precision floating-point number.
@@ -32,10 +32,10 @@ var FLOAT32_SQRT3 = require( '@stdlib/constants/float32/sqrt-three' ); #### FLOAT32_SQRT3 -[Square root][@stdlib/math/base/special/sqrt] of `3` as a single-precision floating-point number. +[Square root][@stdlib/math/base/special/sqrtf] of `3` as a single-precision floating-point number. ```javascript -var bool = ( FLOAT32_SQRT3 === 1.7320507764816284); +var bool = ( FLOAT32_SQRT3 === 1.7320507764816284 ); // returns true ``` @@ -90,7 +90,7 @@ console.log( FLOAT32_SQRT3 ); #### STDLIB_CONSTANT_FLOAT32_SQRT3 -Macro for the [square root][@stdlib/math/base/special/sqrt] of `3`. +Macro for the [square root][@stdlib/math/base/special/sqrtf] of `3`.
@@ -128,7 +128,7 @@ Macro for the [square root][@stdlib/math/base/special/sqrt] of `3`. diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h b/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h index 4fcb1d098ddb..b94c91bce2d7 100644 --- a/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/include/stdlib/constants/float64/sqrt_three.h @@ -22,6 +22,6 @@ /** * Macro for the square root of 3 as a single-precision floating-point number. */ -#define STDLIB_CONSTANT_FLOAT32_SQRT3 1.7320507764816284 +#define STDLIB_CONSTANT_FLOAT32_SQRT3 1.7320507764816284f #endif // !STDLIB_CONSTANTS_FLOAT32_SQRT_THREE_H diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json b/lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json index 71e11746c2e6..bb399ddbd6d6 100644 --- a/lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/package.json @@ -1,7 +1,7 @@ { - "name": "@stdlib/constants/float64/sqrt-three", + "name": "@stdlib/constants/float32/sqrt-three", "version": "0.0.0", - "description": "Square root of 3.", + "description": "Square root of 3 as a single-precision floating-point number.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -61,9 +61,8 @@ "three", "sqrt3", "ieee754", - "double", - "dbl", + "single", "floating-point", - "float64" + "float32" ] } diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js b/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js index 7e326ec4f424..bba942ed39e6 100644 --- a/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/test/test.js @@ -21,10 +21,8 @@ // MODULES // var tape = require( 'tape' ); -var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var sqrtf = require( '@stdlib/math/base/special/sqrtf' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); -var absf = require( '@stdlib/math/base/special/absf' ); -var EPS = require( '@stdlib/constants/float32/eps' ); var FLOAT32_SQRT3 = require( './../lib' ); @@ -37,20 +35,6 @@ tape( 'main export is a number', function test( t ) { }); tape( 'the exported value is a single-precision floating-point number equal to the square root of 3', function test( t ) { - t.equal( FLOAT32_SQRT3, float64ToFloat32( sqrt( 3 ) ), 'equals sqrt(3)' ); - t.end(); -}); - -tape( 'export equals `sqrt(3)`', function test( t ) { - var delta; - var tol; - var v; - - v = sqrt( 3.0 ); - delta = absf( float64ToFloat32( v - FLOAT32_SQRT3 ) ); - tol = EPS * FLOAT32_SQRT3; - - t.ok( delta <= tol, 'equals sqrt(3) within tolerance '+tol ); - + t.equal( FLOAT32_SQRT3, float64ToFloat32( sqrtf( 3 ) ), 'equals sqrtf(3)' ); t.end(); }); From e39e2aafb0bd0daa5cef05af4c0f5b4e2684fdf6 Mon Sep 17 00:00:00 2001 From: Manvith <148960168+manvith2003@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:56:03 +0530 Subject: [PATCH 4/4] docs: fixed styling --- lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md index 365148cfe677..b8dfa1774648 100644 --- a/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md +++ b/lib/node_modules/@stdlib/constants/float32/sqrt-three/README.md @@ -90,7 +90,7 @@ console.log( FLOAT32_SQRT3 ); #### STDLIB_CONSTANT_FLOAT32_SQRT3 -Macro for the [square root][@stdlib/math/base/special/sqrtf] of `3`. +Macro for the [square root][@stdlib/math/base/special/sqrtf] of `3` as a single-precision floating-point number.