Skip to content

Commit 1e24186

Browse files
feat: adding the value of pi for float16
--- 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 ---
1 parent 3138d95 commit 1e24186

File tree

10 files changed

+442
-0
lines changed

10 files changed

+442
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# FLOAT16_PI
22+
23+
> The mathematical constant [π][pi].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var FLOAT16_PI = require( '@stdlib/constants/float16/pi' );
31+
```
32+
33+
#### FLOAT16_PI
34+
35+
The mathematical constant [π][pi].
36+
37+
```javascript
38+
var bool = ( FLOAT16_PI === 3.140625 );
39+
// returns true
40+
```
41+
42+
</section>
43+
44+
<!-- /.usage -->
45+
46+
<section class="examples">
47+
48+
## Examples
49+
50+
<!-- TODO: better example -->
51+
52+
<!-- eslint no-undef: "error" -->
53+
54+
```javascript
55+
var FLOAT16_PI = require( '@stdlib/constants/float16/pi' );
56+
57+
console.log( FLOAT16_PI );
58+
// => 3.140625
59+
```
60+
61+
</section>
62+
63+
<!-- /.examples -->
64+
65+
<!-- C interface documentation. -->
66+
67+
* * *
68+
69+
<section class="c">
70+
71+
## C APIs
72+
73+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
74+
75+
<section class="intro">
76+
77+
</section>
78+
79+
<!-- /.intro -->
80+
81+
<!-- C usage documentation. -->
82+
83+
<section class="usage">
84+
85+
### Usage
86+
87+
```c
88+
#include "stdlib/constants/float16/pi.h"
89+
```
90+
91+
#### STDLIB_CONSTANT_FLOAT16_PI
92+
93+
Macro for the mathematical constant [π][pi].
94+
95+
</section>
96+
97+
<!-- /.usage -->
98+
99+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
100+
101+
<section class="notes">
102+
103+
</section>
104+
105+
<!-- /.notes -->
106+
107+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
108+
109+
<section class="related">
110+
111+
* * *
112+
113+
## See Also
114+
115+
- <span class="package-name">[`@stdlib/constants/float16/fourth-pi`][@stdlib/constants/float16/fourth-pi]</span><span class="delimiter">: </span><span class="description">1/4 times π.</span>
116+
117+
</section>
118+
119+
<!-- /.related -->
120+
121+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
122+
123+
<section class="links">
124+
125+
[pi]: https://en.wikipedia.org/wiki/Pi
126+
127+
<!-- <related-links> -->
128+
129+
[@stdlib/constants/float16/fourth-pi]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/constants/float16/fourth-pi
130+
131+
<!-- </related-links> -->
132+
133+
</section>
134+
135+
<!-- /.links -->
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
{{alias}}
3+
The mathematical constant `π`.
4+
5+
Examples
6+
--------
7+
> {{alias}}
8+
3.140625
9+
10+
See Also
11+
--------
12+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/**
22+
* The mathematical constant `π`.
23+
*
24+
* @example
25+
* var val = FLOAT16_PI;
26+
* // returns 3.140625
27+
*/
28+
declare const FLOAT16_PI: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT16_PI;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import FLOAT16_PI = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The export is a number...
25+
{
26+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
27+
FLOAT16_PI; // $ExpectType number
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
var FLOAT16_PI = require( './../lib' );
22+
23+
console.log( FLOAT16_PI );
24+
// => 3.140625
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef STDLIB_CONSTANTS_FLOAT16_PI_H
20+
#define STDLIB_CONSTANTS_FLOAT16_PI_H
21+
22+
/**
23+
* Macro for the mathematical constant π.
24+
*/
25+
#define STDLIB_CONSTANT_FLOAT16_PI 3.140625
26+
27+
#endif // !STDLIB_CONSTANTS_FLOAT16_PI_H
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* The mathematical constant `π`.
23+
*
24+
* @module @stdlib/constants/float16/pi
25+
* @type {number}
26+
*
27+
* @example
28+
* var FLOAT16_PI = require( '@stdlib/constants/float16/pi' );
29+
* // returns 3.140625
30+
*/
31+
32+
/**
33+
* The mathematical constant `π`.
34+
*
35+
* @constant
36+
* @type {number}
37+
* @default 3.140625
38+
* @see [Wikipedia]{@link https://en.wikipedia.org/wiki/Pi}
39+
*/
40+
var FLOAT16_PI = 3.140625;
41+
42+
43+
// EXPORTS //
44+
45+
module.exports = FLOAT16_PI;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"options": {},
3+
"fields": [
4+
{
5+
"field": "src",
6+
"resolve": true,
7+
"relative": true
8+
},
9+
{
10+
"field": "include",
11+
"resolve": true,
12+
"relative": true
13+
},
14+
{
15+
"field": "libraries",
16+
"resolve": false,
17+
"relative": false
18+
},
19+
{
20+
"field": "libpath",
21+
"resolve": true,
22+
"relative": false
23+
}
24+
],
25+
"confs": [
26+
{
27+
"src": [],
28+
"include": [
29+
"./include"
30+
],
31+
"libraries": [],
32+
"libpath": [],
33+
"dependencies": []
34+
}
35+
]
36+
}

0 commit comments

Comments
 (0)