Skip to content

Commit 893cb1b

Browse files
authored
feat: add constants/float32/ln-two
PR-URL: #3079 Reviewed-by: Philipp Burckhardt <[email protected]>
1 parent 6715177 commit 893cb1b

File tree

10 files changed

+474
-0
lines changed

10 files changed

+474
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 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_LN2
22+
23+
> [Natural logarithm][@stdlib/math/base/special/lnf] of `2` as a single-precision floating-point number.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var FLOAT32_LN2 = require( '@stdlib/constants/float32/ln-two' );
31+
```
32+
33+
#### FLOAT32_LN2
34+
35+
[Natural logarithm][@stdlib/math/base/special/lnf] of `2` as a single-precision floating-point number.
36+
37+
```javascript
38+
var bool = ( FLOAT32_LN2 === 0.6931471824645996 );
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_LN2 = require( '@stdlib/constants/float32/ln-two' );
54+
55+
console.log( FLOAT32_LN2 );
56+
// => 0.6931471824645996
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/ln_two.h"
87+
```
88+
89+
#### STDLIB_CONSTANT_FLOAT32_LN2
90+
91+
Macro for the [natural logarithm][@stdlib/math/base/special/lnf] of `2` as a single-precision floating-point number.
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+
[@stdlib/math/base/special/lnf]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/lnf
130+
131+
<!-- <related-links> -->
132+
133+
<!-- </related-links> -->
134+
135+
</section>
136+
137+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
{{alias}}
3+
Natural logarithm of `2` as a single-precision floating-point number.
4+
5+
Examples
6+
--------
7+
> {{alias}}
8+
0.6931471824645996
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) 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+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Natural logarithm of `2` as a single-precision floating-point number.
23+
*
24+
* @example
25+
* var val = FLOAT32_LN2;
26+
* // returns 0.6931471824645996
27+
*/
28+
declare const FLOAT32_LN2: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT32_LN2;
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 FLOAT32_LN2 = 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_LN2; // $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) 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+
'use strict';
20+
21+
var FLOAT32_LN2 = require( './../lib' );
22+
23+
console.log( FLOAT32_LN2 );
24+
// => 0.6931471824645996
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
#ifndef STDLIB_CONSTANTS_FLOAT32_LN2_H
20+
#define STDLIB_CONSTANTS_FLOAT32_LN2_H
21+
22+
/**
23+
* Macro for the natural logarithm of `2` as a single-precision floating-point number.
24+
*/
25+
#define STDLIB_CONSTANT_FLOAT32_LN2 0.6931471824645996
26+
27+
#endif // !STDLIB_CONSTANTS_FLOAT32_LN2_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
'use strict';
20+
21+
/**
22+
* Natural logarithm of `2` as a single-precision floating-point number.
23+
*
24+
* @module @stdlib/constants/float32/ln-two
25+
* @type {number}
26+
*
27+
* @example
28+
* var FLOAT32_LN2 = require( '@stdlib/constants/float32/ln-two' );
29+
* // returns 0.6931471824645996
30+
*/
31+
32+
33+
// MAIN //
34+
35+
/**
36+
* Natural logarithm of `2` as a single-precision floating-point number.
37+
*
38+
* ```tex
39+
* \ln 2
40+
* ```
41+
*
42+
* @constant
43+
* @type {number}
44+
* @default 0.6931471824645996
45+
*/
46+
var FLOAT32_LN2 = 0.6931471824645996;
47+
48+
49+
// EXPORTS //
50+
51+
module.exports = FLOAT32_LN2;
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)