Skip to content

Commit 31e9467

Browse files
committed
feat: js files added
1 parent 3738279 commit 31e9467

File tree

4 files changed

+162
-1
lines changed

4 files changed

+162
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
* Test if a finite single-precision floating-point number is an odd number.
23+
*
24+
* @module @stdlib/math/base/assert/is-oddf
25+
*
26+
* @example
27+
* var isOddf = require( '@stdlib/math/base/assert/is-oddf' );
28+
*
29+
* var bool = isOddf( 5.0 );
30+
* // returns true
31+
*
32+
* bool = isOddf( -2.0 );
33+
* // returns false
34+
*
35+
* bool = isOddf( 0.0 );
36+
* // returns false
37+
*
38+
* bool = isOddf( NaN );
39+
* // returns false
40+
*/
41+
42+
// MODULES //
43+
44+
var main = require( './main.js' );
45+
46+
47+
// EXPORTS //
48+
49+
module.exports = main;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 isEvenf = require( '@stdlib/math/base/assert/is-evenf' );
24+
25+
26+
// MAIN //
27+
28+
/**
29+
* Tests if a finite single-precision floating-point number is an odd number.
30+
*
31+
* @param {number} x - value to test
32+
* @returns {boolean} boolean indicating whether the value is an odd number
33+
*
34+
* @example
35+
* var bool = isOddf( 5.0 );
36+
* // returns true
37+
*
38+
* @example
39+
* var bool = isOddf( -2.0 );
40+
* // returns false
41+
*
42+
* @example
43+
* var bool = isOddf( 0.0 );
44+
* // returns false
45+
*
46+
* @example
47+
* var bool = isOddf( NaN );
48+
* // returns false
49+
*/
50+
function isOddf( x ) {
51+
// Check sign to prevent overflow...
52+
if ( x > 0.0 ) {
53+
return isEvenf( x - 1.0 );
54+
}
55+
return isEvenf( x + 1.0 );
56+
}
57+
58+
59+
// EXPORTS //
60+
61+
module.exports = isOddf;
Lines changed: 51 additions & 0 deletions
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+
// MODULES //
22+
23+
var Boolean = require( '@stdlib/boolean/ctor' );
24+
var addon = require( './../src/addon.node' );
25+
26+
27+
// MAIN //
28+
29+
/**
30+
* Tests if a finite single-precision floating-point number is an odd number.
31+
*
32+
* @private
33+
* @param {number} x - value to test
34+
* @returns {boolean} boolean indicating whether the number is odd
35+
*
36+
* @example
37+
* var bool = isOddf( 2.0 );
38+
* // returns false
39+
*
40+
* @example
41+
* var bool = isOddf( 5.0 );
42+
* // returns true
43+
*/
44+
function isOddf( x ) {
45+
return Boolean( addon( x ) );
46+
}
47+
48+
49+
// EXPORTS //
50+
51+
module.exports = isOddf;

lib/node_modules/@stdlib/math/base/assert/is-oddf/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"libraries": [],
3434
"libpath": [],
3535
"dependencies": [
36-
"@stdlib/math/base/assert/is-even"
36+
"@stdlib/math/base/assert/is-evenf"
3737
]
3838
}
3939
]

0 commit comments

Comments
 (0)