Skip to content

Commit 40ba86d

Browse files
hrshyakgryte
andauthored
feat: add constants/float32/min-ln
PR-URL: #6261 Ref: #649 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]> Signed-off-by: Harsh <[email protected]> Signed-off-by: Athan Reines <[email protected]>
1 parent 9b72f0c commit 40ba86d

File tree

10 files changed

+467
-0
lines changed

10 files changed

+467
-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) 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_MIN_LN
22+
23+
> [Natural logarithm][natural-logarithm] of the smallest **normalized** [single-precision floating-point number][ieee754].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var FLOAT32_MIN_LN = require( '@stdlib/constants/float32/min-ln' );
31+
```
32+
33+
#### FLOAT32_MIN_LN
34+
35+
[Natural logarithm][natural-logarithm] of the smallest **normalized** [single-precision floating-point number][ieee754].
36+
37+
```javascript
38+
var bool = ( FLOAT32_MIN_LN === -87.3365478515625 );
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 FLOAT32_MIN_LN = require( '@stdlib/constants/float32/min-ln' );
56+
57+
console.log( FLOAT32_MIN_LN );
58+
// => -87.3365478515625
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/float32/min_ln.h"
89+
```
90+
91+
#### STDLIB_CONSTANT_FLOAT32_MIN_LN
92+
93+
Macro for the [natural logarithm][natural-logarithm] of the smallest **normalized** [single-precision floating-point number][ieee754].
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+
<!-- C API usage examples. -->
108+
109+
<section class="examples">
110+
111+
</section>
112+
113+
<!-- /.examples -->
114+
115+
</section>
116+
117+
<!-- /.c -->
118+
119+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
120+
121+
<section class="related">
122+
123+
</section>
124+
125+
<!-- /.related -->
126+
127+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
128+
129+
<section class="links">
130+
131+
[ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985
132+
133+
[natural-logarithm]: https://en.wikipedia.org/wiki/Natural_logarithm
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 the smallest normalized single-precision floating-point
4+
number.
5+
6+
Examples
7+
--------
8+
> {{alias}}
9+
-87.3365478515625
10+
11+
See Also
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+
* Natural logarithm of the smallest normalized single-precision floating-point number.
23+
*
24+
* @example
25+
* var min = FLOAT32_MIN_LN;
26+
* // returns -87.3365478515625
27+
*/
28+
declare const FLOAT32_MIN_LN: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT32_MIN_LN;
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_MIN_LN = 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_MIN_LN; // $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_MIN_LN = require( './../lib' );
22+
23+
console.log( FLOAT32_MIN_LN );
24+
// => -87.3365478515625
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_MIN_LN_H
20+
#define STDLIB_CONSTANTS_FLOAT32_MIN_LN_H
21+
22+
/**
23+
* Macro for the natural logarithm of the smallest normalized single-precision floating-point number.
24+
*/
25+
#define STDLIB_CONSTANT_FLOAT32_MIN_LN -87.3365478515625f
26+
27+
#endif // !STDLIB_CONSTANTS_FLOAT32_MIN_LN_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
* Natural logarithm of the smallest normalized single-precision floating-point number.
23+
*
24+
* @module @stdlib/constants/float32/min-ln
25+
* @type {number}
26+
*
27+
* @example
28+
* var FLOAT32_MIN_LN = require( '@stdlib/constants/float32/min-ln' );
29+
* // returns -87.3365478515625
30+
*/
31+
32+
// MAIN //
33+
34+
/**
35+
* Natural logarithm of the smallest normalized single-precision floating-point number.
36+
*
37+
* ## Notes
38+
*
39+
* The number has the value
40+
*
41+
* ```tex
42+
* -\ln \left( 2^{127-1} \right)
43+
* ```
44+
*
45+
* @constant
46+
* @type {number}
47+
* @default -87.3365478515625
48+
* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}
49+
*/
50+
var FLOAT32_MIN_LN = -87.3365478515625;
51+
52+
53+
// EXPORTS //
54+
55+
module.exports = FLOAT32_MIN_LN;
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)