-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: add constants/float64/inv-two-pi
#8982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 3 commits
7a45af2
cc26a22
fdcc9c9
2c4a581
e44bf0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| <!-- | ||
|
|
||
| @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. | ||
|
|
||
| --> | ||
|
|
||
| # FLOAT64_INV_TWO_PI | ||
|
|
||
| > Inverse of twice the mathematical constant [π][pi] (1/(2π)). | ||
|
|
||
| <section class="usage"> | ||
|
|
||
| ## Usage | ||
|
|
||
| ```javascript | ||
| var FLOAT64_INV_TWO_PI = require( '@stdlib/constants/float64/inv-two-pi' ); | ||
| ``` | ||
|
|
||
| #### FLOAT64_INV_TWO_PI | ||
|
|
||
| Inverse of twice the mathematical constant [π][pi] (1/(2π)). | ||
|
|
||
| ```javascript | ||
| var bool = ( FLOAT64_INV_TWO_PI === 0.15915494309189535 ); | ||
| // returns true | ||
| ``` | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.usage --> | ||
|
|
||
| <section class="examples"> | ||
|
|
||
| ## Examples | ||
|
|
||
| <!-- eslint no-undef: "error" --> | ||
|
|
||
| ```javascript | ||
| var FLOAT64_INV_TWO_PI = require( '@stdlib/constants/float64/inv-two-pi' ); | ||
|
|
||
| console.log( FLOAT64_INV_TWO_PI ); | ||
| // => 0.15915494309189535 | ||
| ``` | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.examples --> | ||
|
|
||
| <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> | ||
|
|
||
| <section class="related"> | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.related --> | ||
|
|
||
| <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
|
|
||
| <section class="links"> | ||
|
|
||
| [pi]: https://en.wikipedia.org/wiki/Pi | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.links --> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| {{alias}} | ||
| Inverse of twice the mathematical constant `π` (1/(2π)). | ||
|
|
||
| Examples | ||
| -------- | ||
| > {{alias}} | ||
| 0.15915494309189535 | ||
|
|
||
| See Also | ||
| -------- | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
|
||
| /** | ||
| * Inverse of twice the mathematical constant `π` (1/(2π)). | ||
| * | ||
| * @example | ||
| * var val = FLOAT64_INV_TWO_PI; | ||
| * // returns 0.15915494309189535 | ||
| */ | ||
| declare const FLOAT64_INV_TWO_PI: number; | ||
|
|
||
|
|
||
| // EXPORTS // | ||
|
|
||
| export = FLOAT64_INV_TWO_PI; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 FLOAT64_INV_TWO_PI = require( './index' ); | ||
|
|
||
|
|
||
| // TESTS // | ||
|
|
||
| // The export is a number... | ||
| { | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-expressions | ||
| FLOAT64_INV_TWO_PI; // $ExpectType number | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 FLOAT64_INV_TWO_PI = require( './../lib' ); | ||
|
|
||
| console.log( FLOAT64_INV_TWO_PI ); | ||
| // => 0.15915494309189535 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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_FLOAT64_INV_TWO_PI_H | ||
| #define STDLIB_CONSTANTS_FLOAT64_INV_TWO_PI_H | ||
|
|
||
| /** | ||
| * Macro for the inverse of 2π (1/(2π)). | ||
| */ | ||
| #define STDLIB_CONSTANT_FLOAT64_INV_TWO_PI 0.15915494309189533577 | ||
|
||
|
|
||
| #endif // !STDLIB_CONSTANTS_FLOAT64_INV_TWO_PI_H | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| /** | ||||||
| * @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'; | ||||||
|
|
||||||
| /** | ||||||
| * Inverse of twice the mathematical constant `π` (1/(2π)). | ||||||
| * | ||||||
| * @module @stdlib/constants/float64/inv-two-pi | ||||||
| * @type {number} | ||||||
| * | ||||||
| * @example | ||||||
| * var FLOAT64_INV_TWO_PI = require( '@stdlib/constants/float64/inv-two-pi' ); | ||||||
| * // returns 0.15915494309189535 | ||||||
| */ | ||||||
|
|
||||||
|
|
||||||
| // MAIN // | ||||||
|
|
||||||
| /** | ||||||
| * Inverse of twice the mathematical constant `π` (1/(2π)). | ||||||
| * | ||||||
| * @constant | ||||||
| * @type {number} | ||||||
| * @default 0.15915494309189535 | ||||||
| * @see [Wikipedia]{@link https://en.wikipedia.org/wiki/Pi} | ||||||
| */ | ||||||
| var FLOAT64_INV_TWO_PI = 0.15915494309189533576888376337251436203445964574045644874766734405889679763422653509534861042142103174415371554; // eslint-disable-line max-len | ||||||
|
||||||
| var FLOAT64_INV_TWO_PI = 0.15915494309189533576888376337251436203445964574045644874766734405889679763422653509534861042142103174415371554; // eslint-disable-line max-len | |
| var FLOAT64_INV_TWO_PI = 0.15915494309189535; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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": [] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| { | ||
| "name": "@stdlib/constants/float64/inv-two-pi", | ||
| "version": "0.0.0", | ||
| "description": "Inverse of 2π (1/(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", | ||
| "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", | ||
| "inverse", | ||
| "inv", | ||
| "pi", | ||
| "two-pi", | ||
| "2pi", | ||
| "ieee754", | ||
| "double", | ||
| "dbl", | ||
| "precision", | ||
| "floating-point", | ||
| "float64" | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you have added an C header file you'll have to add the documentation for C usage as well. To address the macro version.