Skip to content

Commit 1491b9c

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents c38f78b + ca3dd82 commit 1491b9c

File tree

527 files changed

+32470
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

527 files changed

+32470
-493
lines changed

lib/node_modules/@stdlib/_tools/licenses/licenses/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var licenses = require( '@stdlib/_tools/licenses/licenses' );
3838

3939
#### licenses( \[options], clbk )
4040

41-
Reads installed package dependencies and extracts license information from `package.json` files.
41+
Reads installed package dependencies and extracts license information from `package.json` files.
4242

4343
```javascript
4444
licenses( onResults );

lib/node_modules/@stdlib/math/base/special/cinv/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ int main() {
228228
## See Also
229229

230230
- <span class="package-name">[`@stdlib/complex/float64/base/div`][@stdlib/complex/float64/base/div]</span><span class="delimiter">: </span><span class="description">divide two complex numbers.</span>
231+
- <span class="package-name">[`@stdlib/math/base/special/cinvf`][@stdlib/math/base/special/cinvf]</span><span class="delimiter">: </span><span class="description">compute the inverse of a single-precision complex floating-point number.</span>
231232

232233
</section>
233234

@@ -249,6 +250,8 @@ int main() {
249250

250251
[@stdlib/complex/float64/base/div]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/div
251252

253+
[@stdlib/math/base/special/cinvf]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/cinvf
254+
252255
<!-- </related-links> -->
253256

254257
</section>

lib/node_modules/@stdlib/math/base/special/cosm1/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* // returns 0.0
3232
*
3333
* v = cosm1( PI/4.0 );
34-
* // returns ~-0.291
34+
* // returns ~-0.293
3535
*
3636
* v = cosm1( -PI/6.0 );
3737
* // returns ~-0.134

lib/node_modules/@stdlib/math/base/special/cosm1/test/fixtures/python/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/cosm1/test/fixtures/python/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def gen(x, name):
5353
}
5454

5555
# Based on the script directory, create an output filepath:
56-
filepath = os.path.join(dir, name)
56+
filepath = os.path.join(DIR, name)
5757

5858
# Write the data to the output filepath as JSON:
5959
with open(filepath, "w", encoding="utf-8") as outfile:

lib/node_modules/@stdlib/math/base/special/cosm1/test/test.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ var data = require( './fixtures/python/data.json' );
4747

4848
tape( 'main export is a function', function test( t ) {
4949
t.ok( true, __filename );
50-
t.strictEqual( typeof cos, 'function', 'main export is a function' );
50+
t.strictEqual( typeof cosm1, 'function', 'main export is a function' );
5151
t.end();
5252
});
5353

5454
tape( 'the function computes the cosine minus one more accurately inside the interval [-π/4,π/4]', function test( t ) {
5555
var expected;
56-
var delta;
57-
var tol;
5856
var x;
5957
var y;
6058
var i;
@@ -64,13 +62,7 @@ tape( 'the function computes the cosine minus one more accurately inside the int
6462

6563
for ( i = 0; i < x.length; i++ ) {
6664
y = cosm1( x[i] );
67-
if ( y === expected[ i ] ) {
68-
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
69-
} else {
70-
delta = abs( y - expected[i] );
71-
tol = 2.0 * EPS * abs( expected[i] );
72-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
73-
}
65+
t.strictEqual( y, expected[ i ], 'returns expected value' );
7466
}
7567

7668
t.end();

lib/node_modules/@stdlib/math/base/special/cosm1/test/test.native.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,12 @@ var data = require( './fixtures/python/data.json' );
5252

5353
tape( 'main export is a function', opts, function test( t ) {
5454
t.ok( true, __filename );
55-
t.strictEqual( typeof cos, 'function', 'main export is a function' );
55+
t.strictEqual( typeof cosm1, 'function', 'main export is a function' );
5656
t.end();
5757
});
5858

5959
tape( 'the function computes the cosine minus one more accurately inside the interval [-π/4,π/4]', opts, function test( t ) {
6060
var expected;
61-
var delta;
62-
var tol;
6361
var x;
6462
var y;
6563
var i;
@@ -69,13 +67,7 @@ tape( 'the function computes the cosine minus one more accurately inside the int
6967

7068
for ( i = 0; i < x.length; i++ ) {
7169
y = cosm1( x[i] );
72-
if ( y === expected[ i ] ) {
73-
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
74-
} else {
75-
delta = abs( y - expected[i] );
76-
tol = 2.0 * EPS * abs( expected[i] );
77-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
78-
}
70+
t.strictEqual( y, expected[ i ], 'returns expected value' );
7971
}
8072

8173
t.end();
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
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+
# Hacovercosine
22+
23+
> Compute the half-value [coversed cosine][coversed-cosine] of a single-precision floating-point number (in radians).
24+
25+
<section class="intro">
26+
27+
The half-value [coversed cosine][coversed-cosine] is defined as
28+
29+
<!-- <equation class="equation" label="eq:hacovercosine" align="center" raw="\operatorname{hacovercos}(\theta) = \frac{1 + \sin \theta}{2}" alt="Half-value coversed cosine."> -->
30+
31+
```math
32+
\mathop{\mathrm{hacovercos}}(\theta) = \frac{1 + \sin \theta}{2}
33+
```
34+
35+
<!-- </equation> -->
36+
37+
</section>
38+
39+
<!-- /.intro -->
40+
41+
<section class="usage">
42+
43+
## Usage
44+
45+
```javascript
46+
var hacovercosf = require( '@stdlib/math/base/special/hacovercosf' );
47+
```
48+
49+
#### hacovercosf( x )
50+
51+
Computes the half-value [coversed cosine][coversed-cosine] of a single-precision floating-point number (in radians).
52+
53+
```javascript
54+
var v = hacovercosf( 0.0 );
55+
// returns 0.5
56+
57+
v = hacovercosf( 3.141592653589793/2.0 );
58+
// returns 1.0
59+
60+
v = hacovercosf( -3.141592653589793/6.0 );
61+
// returns 0.25
62+
```
63+
64+
</section>
65+
66+
<!-- /.usage -->
67+
68+
<section class="examples">
69+
70+
## Examples
71+
72+
<!-- eslint no-undef: "error" -->
73+
74+
```javascript
75+
var uniform = require( '@stdlib/random/array/uniform' );
76+
var logEachMap = require( '@stdlib/console/log-each-map' );
77+
var TWO_PI = require( '@stdlib/constants/float32/two-pi' );
78+
var hacovercosf = require( '@stdlib/math/base/special/hacovercosf' );
79+
80+
var opts = {
81+
'dtype': 'float32'
82+
};
83+
var x = uniform( 100, 0.0, TWO_PI, opts );
84+
85+
logEachMap( 'hacovercosf(%0.4f) = %0.4f', x, hacovercosf );
86+
```
87+
88+
</section>
89+
90+
<!-- /.examples -->
91+
92+
<!-- C interface documentation. -->
93+
94+
* * *
95+
96+
<section class="c">
97+
98+
## C APIs
99+
100+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
101+
102+
<section class="intro">
103+
104+
</section>
105+
106+
<!-- /.intro -->
107+
108+
<!-- C usage documentation. -->
109+
110+
<section class="usage">
111+
112+
### Usage
113+
114+
```c
115+
#include "stdlib/math/base/special/hacovercosf.h"
116+
```
117+
118+
#### stdlib_base_hacovercosf( x )
119+
120+
Computes the half-value [coversed cosine][coversed-cosine] of a single-precision floating-point number (in radians).
121+
122+
```c
123+
float out = stdlib_base_hacovercosf( 0.0f );
124+
// returns 0.5f
125+
126+
out = stdlib_base_hacovercosf( 3.141592653589793f / 2.0f );
127+
// returns 1.0f
128+
```
129+
130+
The function accepts the following arguments:
131+
132+
- **x**: `[in] float` input value (in radians).
133+
134+
```c
135+
float stdlib_base_hacovercosf( const float x );
136+
```
137+
138+
</section>
139+
140+
<!-- /.usage -->
141+
142+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
143+
144+
<section class="notes">
145+
146+
</section>
147+
148+
<!-- /.notes -->
149+
150+
<!-- C API usage examples. -->
151+
152+
<section class="examples">
153+
154+
### Examples
155+
156+
```c
157+
#include "stdlib/math/base/special/hacovercosf.h"
158+
#include <stdio.h>
159+
160+
int main( void ) {
161+
const float x[] = { 0.0f, 0.523f, 0.785f, 1.047f, 3.14f };
162+
163+
float y;
164+
int i;
165+
for ( i = 0; i < 5; i++ ) {
166+
y = stdlib_base_hacovercosf( x[ i ] );
167+
printf( "hacovercosf(%f) = %f\n", x[ i ], y );
168+
}
169+
}
170+
```
171+
172+
</section>
173+
174+
<!-- /.examples -->
175+
176+
</section>
177+
178+
<!-- /.c -->
179+
180+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
181+
182+
<section class="related">
183+
184+
</section>
185+
186+
<!-- /.related -->
187+
188+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
189+
190+
<section class="links">
191+
192+
[coversed-cosine]: https://en.wikipedia.org/wiki/Versine
193+
194+
<!-- <related-links> -->
195+
196+
<!-- </related-links> -->
197+
198+
</section>
199+
200+
<!-- /.links -->
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
26+
var pkg = require( './../package.json' ).name;
27+
var hacovercosf = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( pkg, function benchmark( b ) {
33+
var x;
34+
var y;
35+
var i;
36+
37+
x = uniform( 100, -10.0, 10.0, {
38+
'dtype': 'float32'
39+
});
40+
41+
b.tic();
42+
for ( i = 0; i < b.iterations; i++ ) {
43+
y = hacovercosf( x[ i%x.length ] );
44+
if ( isnanf( y ) ) {
45+
b.fail( 'should not return NaN' );
46+
}
47+
}
48+
b.toc();
49+
if ( isnanf( y ) ) {
50+
b.fail( 'should not return NaN' );
51+
}
52+
b.pass( 'benchmark finished' );
53+
b.end();
54+
});

0 commit comments

Comments
 (0)