Skip to content

Commit 04f0f1e

Browse files
Neerajpathak07stdlib-bot
andauthoredMar 18, 2025
feat: add constants/float32/gamma-lanczos-g
PR-URL: stdlib-js#6096 Closes: stdlib-js#6097 Ref: stdlib-js#649 Reviewed-by: Athan Reines <kgryte@gmail.com> Co-authored-by: stdlib-bot <noreply@stdlib.io>
1 parent 6373477 commit 04f0f1e

File tree

10 files changed

+475
-0
lines changed

10 files changed

+475
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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+
# FLOAT32_GAMMA_LANCZOS_G
22+
23+
> Arbitrary constant `g` to be used in Lanczos approximation functions.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var FLOAT32_GAMMA_LANCZOS_G = require( '@stdlib/constants/float32/gamma-lanczos-g' );
37+
```
38+
39+
#### FLOAT32_GAMMA_LANCZOS_G
40+
41+
Arbitrary constant `g` to be used in [Lanczos approximation][lanczos-approximation] functions.
42+
43+
```javascript
44+
var bool = ( FLOAT32_GAMMA_LANCZOS_G === 10.900510787963867 );
45+
// returns true
46+
```
47+
48+
</section>
49+
50+
<!-- /.usage -->
51+
52+
<section class="examples">
53+
54+
## Examples
55+
56+
<!-- eslint no-undef: "error" -->
57+
58+
```javascript
59+
var FLOAT32_GAMMA_LANCZOS_G = require( '@stdlib/constants/float32/gamma-lanczos-g' );
60+
61+
console.log( FLOAT32_GAMMA_LANCZOS_G );
62+
// => 10.900510787963867
63+
```
64+
65+
</section>
66+
67+
<!-- /.examples -->
68+
69+
<!-- C interface documentation. -->
70+
71+
* * *
72+
73+
<section class="c">
74+
75+
## C APIs
76+
77+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
78+
79+
<section class="intro">
80+
81+
</section>
82+
83+
<!-- /.intro -->
84+
85+
<!-- C usage documentation. -->
86+
87+
<section class="usage">
88+
89+
### Usage
90+
91+
```c
92+
#include "stdlib/constants/float32/gamma_lanczos_g.h"
93+
```
94+
95+
#### STDLIB_CONSTANT_FLOAT32_GAMMA_LANCZOS_G
96+
97+
Macro for the arbitrary constant `g` to be used in [Lanczos approximation][lanczos-approximation] functions.
98+
99+
</section>
100+
101+
<!-- /.usage -->
102+
103+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
104+
105+
<section class="notes">
106+
107+
</section>
108+
109+
<!-- /.notes -->
110+
111+
<!-- C API usage examples. -->
112+
113+
<section class="examples">
114+
115+
</section>
116+
117+
<!-- /.examples -->
118+
119+
</section>
120+
121+
<!-- /.c -->
122+
123+
* * *
124+
125+
<section class="references">
126+
127+
## References
128+
129+
- Pugh, Glendon R. 2004. "An analysis of the Lanczos gamma approximation." PhD thesis, University of British Columbia. [&lt;https://web.viu.ca/pughg/phdThesis/phdThesis.pdf>][@pugh:2004a].
130+
131+
</section>
132+
133+
<!-- /.references -->
134+
135+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
136+
137+
<section class="related">
138+
139+
</section>
140+
141+
<!-- /.related -->
142+
143+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
144+
145+
<section class="links">
146+
147+
[lanczos-approximation]: https://en.wikipedia.org/wiki/Lanczos_approximation
148+
149+
[@pugh:2004a]: https://web.viu.ca/pughg/phdThesis/phdThesis.pdf
150+
151+
</section>
152+
153+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
{{alias}}
3+
Arbitrary constant `g` to be used in Lanczos approximation functions.
4+
5+
Examples
6+
--------
7+
> {{alias}}
8+
10.900510787963867
9+
10+
See Also
11+
--------
12+
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+
* Arbitrary constant `g` to be used in Lanczos approximation functions.
23+
*
24+
* @example
25+
* var g = FLOAT32_GAMMA_LANCZOS_G;
26+
* // returns 10.900510787963867
27+
*/
28+
declare const FLOAT32_GAMMA_LANCZOS_G: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT32_GAMMA_LANCZOS_G;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
import FLOAT32_GAMMA_LANCZOS_G = 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+
FLOAT32_GAMMA_LANCZOS_G; // $ExpectType number
28+
}
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 FLOAT32_GAMMA_LANCZOS_G = require( './../lib' );
22+
23+
console.log( FLOAT32_GAMMA_LANCZOS_G );
24+
// => 10.900510787963867
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_FLOAT32_GAMMA_LANCZOS_G_H
20+
#define STDLIB_CONSTANTS_FLOAT32_GAMMA_LANCZOS_G_H
21+
22+
/**
23+
* Macro for the arbitrary constant `g` to be used in Lanczos approximation functions.
24+
*/
25+
#define STDLIB_CONSTANT_FLOAT32_GAMMA_LANCZOS_G 10.900511f
26+
27+
#endif // !STDLIB_CONSTANTS_FLOAT32_GAMMA_LANCZOS_G_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
* Arbitrary constant `g` to be used in Lanczos approximation functions.
23+
*
24+
* @module @stdlib/constants/float32/gamma-lanczos-g
25+
* @type {number}
26+
*
27+
* @example
28+
* var FLOAT32_GAMMA_LANCZOS_G = require( '@stdlib/constants/float32/gamma-lanczos-g' );
29+
* // returns 10.900510787963867
30+
*/
31+
32+
// MODULES //
33+
34+
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
35+
36+
37+
// MAIN //
38+
39+
/**
40+
* Arbitrary constant `g` to be used in Lanczos approximation functions.
41+
*
42+
* @constant
43+
* @type {number}
44+
* @default 10.900510787963867
45+
* @see [Lanczos Approximation]{@link https://en.wikipedia.org/wiki/Lanczos_approximation}
46+
*/
47+
var FLOAT32_GAMMA_LANCZOS_G = float64ToFloat32( 10.900511 );
48+
49+
50+
// EXPORTS //
51+
52+
module.exports = FLOAT32_GAMMA_LANCZOS_G;
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)
Please sign in to comment.