Skip to content

Commit cdded38

Browse files
committed
Auto-generated commit
1 parent 1a9d64c commit cdded38

File tree

91 files changed

+6754
-0
lines changed

Some content is hidden

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

91 files changed

+6754
-0
lines changed
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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+
# isComplexFloatingPointDataType
22+
23+
> Test if an input value is a supported array complex-valued floating-point data type.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
<!-- eslint-disable id-length -->
40+
41+
```javascript
42+
var isComplexFloatingPointDataType = require( '@stdlib/array/base/assert/is-complex-floating-point-data-type' );
43+
```
44+
45+
#### isComplexFloatingPointDataType( value )
46+
47+
Tests if an input `value` is a supported array complex-valued floating-point data type.
48+
49+
<!-- eslint-disable id-length -->
50+
51+
```javascript
52+
var bool = isComplexFloatingPointDataType( 'complex128' );
53+
// returns true
54+
55+
bool = isComplexFloatingPointDataType( 'uint32' );
56+
// returns false
57+
```
58+
59+
</section>
60+
61+
<!-- /.usage -->
62+
63+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
64+
65+
<section class="notes">
66+
67+
</section>
68+
69+
<!-- /.notes -->
70+
71+
<!-- Package usage examples. -->
72+
73+
<section class="examples">
74+
75+
## Examples
76+
77+
<!-- eslint-disable id-length -->
78+
79+
<!-- eslint no-undef: "error" -->
80+
81+
```javascript
82+
var isComplexFloatingPointDataType = require( '@stdlib/array/base/assert/is-complex-floating-point-data-type' );
83+
84+
var bool = isComplexFloatingPointDataType( 'complex128' );
85+
// returns true
86+
87+
bool = isComplexFloatingPointDataType( 'complex64' );
88+
// returns true
89+
90+
bool = isComplexFloatingPointDataType( 'float32' );
91+
// returns false
92+
93+
bool = isComplexFloatingPointDataType( 'float64' );
94+
// returns false
95+
96+
bool = isComplexFloatingPointDataType( 'generic' );
97+
// returns false
98+
99+
bool = isComplexFloatingPointDataType( 'int16' );
100+
// returns false
101+
102+
bool = isComplexFloatingPointDataType( 'int32' );
103+
// returns false
104+
105+
bool = isComplexFloatingPointDataType( 'int8' );
106+
// returns false
107+
108+
bool = isComplexFloatingPointDataType( 'uint16' );
109+
// returns false
110+
111+
bool = isComplexFloatingPointDataType( 'uint32' );
112+
// returns false
113+
114+
bool = isComplexFloatingPointDataType( 'uint8' );
115+
// returns false
116+
117+
bool = isComplexFloatingPointDataType( 'uint8c' );
118+
// returns false
119+
120+
bool = isComplexFloatingPointDataType( '' );
121+
// returns false
122+
123+
bool = isComplexFloatingPointDataType( 'foo' );
124+
// returns false
125+
```
126+
127+
</section>
128+
129+
<!-- /.examples -->
130+
131+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
132+
133+
<section class="references">
134+
135+
</section>
136+
137+
<!-- /.references -->
138+
139+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
140+
141+
<section class="related">
142+
143+
</section>
144+
145+
<!-- /.related -->
146+
147+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
148+
149+
<section class="links">
150+
151+
</section>
152+
153+
<!-- /.links -->
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
25+
var pkg = require( './../package.json' ).name;
26+
var isComplexFloatingPointDataType = require( './../lib' ); // eslint-disable-line id-length
27+
28+
29+
// MAIN //
30+
31+
bench( pkg, function benchmark( b ) {
32+
var values;
33+
var out;
34+
var v;
35+
var i;
36+
37+
values = [
38+
'binary',
39+
'complex128',
40+
'complex64',
41+
'float32',
42+
'float64',
43+
'generic',
44+
'int16',
45+
'int32',
46+
'int8',
47+
'uint16',
48+
'uint32',
49+
'uint8',
50+
'uint8c',
51+
'foo',
52+
'bar',
53+
'',
54+
'beep',
55+
'boop'
56+
];
57+
58+
b.tic();
59+
for ( i = 0; i < b.iterations; i++ ) {
60+
v = values[ i%values.length ];
61+
out = isComplexFloatingPointDataType( v );
62+
if ( typeof out !== 'boolean' ) {
63+
b.fail( 'should return a boolean' );
64+
}
65+
}
66+
b.toc();
67+
if ( !isBoolean( out ) ) {
68+
b.fail( 'should return a boolean' );
69+
}
70+
b.pass( 'benchmark finished' );
71+
b.end();
72+
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
{{alias}}( value )
3+
Tests if an input value is a supported array complex-valued floating-point
4+
data type.
5+
6+
Parameters
7+
----------
8+
value: any
9+
Value to test.
10+
11+
Returns
12+
-------
13+
bool: boolean
14+
Boolean indicating if an input value is a supported array complex-valued
15+
floating-point data type.
16+
17+
Examples
18+
--------
19+
> var bool = {{alias}}( 'complex64' )
20+
true
21+
> bool = {{alias}}( 'float64' )
22+
false
23+
> bool = {{alias}}( 'int16' )
24+
false
25+
> bool = {{alias}}( 'int32' )
26+
false
27+
> bool = {{alias}}( 'int8' )
28+
false
29+
> bool = {{alias}}( 'uint16' )
30+
false
31+
> bool = {{alias}}( 'uint32' )
32+
false
33+
> bool = {{alias}}( 'uint8' )
34+
false
35+
> bool = {{alias}}( 'uint8c' )
36+
false
37+
> bool = {{alias}}( '' )
38+
false
39+
> bool = {{alias}}( 'beep' )
40+
false
41+
42+
See Also
43+
--------
44+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
* Tests whether an input value is a supported array complex-valued floating-point data type.
23+
*
24+
* @param v - value to test
25+
* @returns boolean indicating whether an input value is a supported array complex-valued floating-point data type
26+
*
27+
* @example
28+
* var bool = isComplexFloatingPointDataType( 'complex64' );
29+
* // returns true
30+
*
31+
* bool = isComplexFloatingPointDataType( 'complex128' );
32+
* // returns true
33+
*
34+
* bool = isComplexFloatingPointDataType( 'float32' );
35+
* // returns false
36+
*
37+
* bool = isComplexFloatingPointDataType( 'float64' );
38+
* // returns false
39+
*
40+
* bool = isComplexFloatingPointDataType( 'generic' );
41+
* // returns false
42+
*
43+
* bool = isComplexFloatingPointDataType( 'int16' );
44+
* // returns false
45+
*
46+
* bool = isComplexFloatingPointDataType( 'int32' );
47+
* // returns false
48+
*
49+
* bool = isComplexFloatingPointDataType( 'int8' );
50+
* // returns false
51+
*
52+
* bool = isComplexFloatingPointDataType( 'uint16' );
53+
* // returns false
54+
*
55+
* bool = isComplexFloatingPointDataType( 'uint32' );
56+
* // returns false
57+
*
58+
* bool = isComplexFloatingPointDataType( 'uint8' );
59+
* // returns false
60+
*
61+
* bool = isComplexFloatingPointDataType( 'uint8c' );
62+
* // returns false
63+
*
64+
* bool = isComplexFloatingPointDataType( 'foo' );
65+
* // returns false
66+
*/
67+
declare function isComplexFloatingPointDataType( v: any ): boolean;
68+
69+
70+
// EXPORTS //
71+
72+
export = isComplexFloatingPointDataType;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 isComplexFloatingPointDataType = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isComplexFloatingPointDataType( 'float32' ); // $ExpectType boolean
27+
isComplexFloatingPointDataType( 'foo' ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isComplexFloatingPointDataType(); // $ExpectError
33+
isComplexFloatingPointDataType( undefined, 123 ); // $ExpectError
34+
}

0 commit comments

Comments
 (0)