Skip to content

Commit 67d1bf8

Browse files
hrshyakgryte
andauthored
feat: add constants/float32/fourth-root-eps
PR-URL: #6373 Ref: #649 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]> Signed-off-by: Athan Reines <[email protected]>
1 parent 7a7d225 commit 67d1bf8

File tree

10 files changed

+461
-0
lines changed

10 files changed

+461
-0
lines changed
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+
# FLOAT32_FOURTH_ROOT_EPS
22+
23+
> [Fourth root][nth-root] of [single-precision floating-point epsilon][@stdlib/constants/float32/eps].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var FLOAT32_FOURTH_ROOT_EPS = require( '@stdlib/constants/float32/fourth-root-eps' );
31+
```
32+
33+
#### FLOAT32_FOURTH_ROOT_EPS
34+
35+
[Fourth root][nth-root] of [single-precision floating-point epsilon][@stdlib/constants/float32/eps].
36+
37+
```javascript
38+
var bool = ( FLOAT32_FOURTH_ROOT_EPS === 0.018581360578536987 );
39+
// returns true
40+
```
41+
42+
</section>
43+
44+
<!-- /.usage -->
45+
46+
<section class="examples">
47+
48+
## Examples
49+
50+
<!-- eslint no-undef: "error" -->
51+
52+
```javascript
53+
var FLOAT32_FOURTH_ROOT_EPS = require( '@stdlib/constants/float32/fourth-root-eps' );
54+
55+
var out = FLOAT32_FOURTH_ROOT_EPS;
56+
// returns 0.018581360578536987
57+
```
58+
59+
</section>
60+
61+
<!-- /.examples -->
62+
63+
<!-- C interface documentation. -->
64+
65+
* * *
66+
67+
<section class="c">
68+
69+
## C APIs
70+
71+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
72+
73+
<section class="intro">
74+
75+
</section>
76+
77+
<!-- /.intro -->
78+
79+
<!-- C usage documentation. -->
80+
81+
<section class="usage">
82+
83+
### Usage
84+
85+
```c
86+
#include "stdlib/constants/float32/fourth_root_eps.h"
87+
```
88+
89+
#### STDLIB_CONSTANT_FLOAT32_FOURTH_ROOT_EPS
90+
91+
Macro for the [fourth root][nth-root] of [single-precision floating-point epsilon][@stdlib/constants/float32/eps].
92+
93+
</section>
94+
95+
<!-- /.usage -->
96+
97+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
98+
99+
<section class="notes">
100+
101+
</section>
102+
103+
<!-- /.notes -->
104+
105+
<!-- C API usage examples. -->
106+
107+
<section class="examples">
108+
109+
</section>
110+
111+
<!-- /.examples -->
112+
113+
</section>
114+
115+
<!-- /.c -->
116+
117+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
118+
119+
<section class="related">
120+
121+
</section>
122+
123+
<!-- /.related -->
124+
125+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
126+
127+
<section class="links">
128+
129+
[nth-root]: https://en.wikipedia.org/wiki/Nth_root
130+
131+
[@stdlib/constants/float32/eps]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/constants/float32/eps
132+
133+
</section>
134+
135+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
{{alias}}
3+
Fourth root of single-precision floating-point epsilon.
4+
5+
Examples
6+
--------
7+
> {{alias}}
8+
0.018581360578536987
9+
10+
See Also
11+
--------
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+
* Fourth root of single-precision floating-point epsilon.
23+
*
24+
* @example
25+
* var eps = FLOAT32_FOURTH_ROOT_EPS;
26+
* // returns 0.018581360578536987
27+
*/
28+
declare const FLOAT32_FOURTH_ROOT_EPS: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT32_FOURTH_ROOT_EPS;
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_FOURTH_ROOT_EPS = 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_FOURTH_ROOT_EPS; // $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_FOURTH_ROOT_EPS = require( './../lib' );
22+
23+
console.log( FLOAT32_FOURTH_ROOT_EPS );
24+
// => 0.018581360578536987
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_FOURTH_ROOT_EPS_H
20+
#define STDLIB_CONSTANTS_FLOAT32_FOURTH_ROOT_EPS_H
21+
22+
/**
23+
* Macro for the fourth root of single-precision floating-point epsilon.
24+
*/
25+
#define STDLIB_CONSTANT_FLOAT32_FOURTH_ROOT_EPS 0.018581360578536987f
26+
27+
#endif // !STDLIB_CONSTANTS_FLOAT32_FOURTH_ROOT_EPS_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
* Fourth root of single-precision floating-point epsilon.
23+
*
24+
* @module @stdlib/constants/float32/fourth-root-eps
25+
* @type {number}
26+
*
27+
* @example
28+
* var FLOAT32_FOURTH_ROOT_EPS = require( '@stdlib/constants/float32/fourth-root-eps' );
29+
* // returns 0.018581360578536987
30+
*/
31+
32+
33+
// MAIN //
34+
35+
/**
36+
* Fourth root of single-precision floating-point epsilon.
37+
*
38+
* ```tex
39+
* \sqrt{\sqrt{\frac{1}{2^{23}}}}
40+
* ```
41+
*
42+
* @constant
43+
* @type {number}
44+
* @default 0.018581360578536987
45+
* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}
46+
* @see [Machine Epsilon]{@link https://en.wikipedia.org/wiki/Machine_epsilon}
47+
*/
48+
var FLOAT32_FOURTH_ROOT_EPS = 0.018581360578536987;
49+
50+
51+
// EXPORTS //
52+
53+
module.exports = FLOAT32_FOURTH_ROOT_EPS;
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)