-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0711fb5
commit 4c2151f
Showing
3 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
lib/node_modules/@stdlib/math/base/special/gcdf/docs/repl.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
{{alias}}( a, b ) | ||
Computes the greatest common divisor (gcd). | ||
|
||
If both `a` and `b` are `0`, the function returns `0`. | ||
|
||
Both `a` and `b` must have integer values; otherwise, the function returns | ||
`NaN`. | ||
|
||
Parameters | ||
---------- | ||
a: integer | ||
First number. | ||
|
||
b: integer | ||
Second number. | ||
|
||
Returns | ||
------- | ||
out: integer | ||
Greatest common divisor. | ||
|
||
Examples | ||
-------- | ||
> var v = {{alias}}( 48, 18 ) | ||
6 | ||
|
||
See Also | ||
-------- | ||
|
50 changes: 50 additions & 0 deletions
50
lib/node_modules/@stdlib/math/base/special/gcdf/docs/types/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2019 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// TypeScript Version: 4.1 | ||
|
||
/** | ||
* Computes the greatest common divisor (gcd). | ||
* | ||
* ## Notes | ||
* | ||
* - If both `a` and `b` are `0`, the function returns `0`. | ||
* - Both `a` and `b` must have integer values; otherwise, the function returns `NaN`. | ||
* | ||
* @param a - first number | ||
* @param b - second number | ||
* @returns greatest common divisor | ||
* | ||
* @example | ||
* var v = gcdf( 48, 18 ); | ||
* // returns 6 | ||
* | ||
* @example | ||
* var v = gcdf( 3.14, 18 ); | ||
* // returns NaN | ||
* | ||
* @example | ||
* var v = gcdf( NaN, 18 ); | ||
* // returns NaN | ||
*/ | ||
declare function gcdf( a: number, b: number ): number; | ||
|
||
|
||
// EXPORTS // | ||
|
||
export = gcdf; |
56 changes: 56 additions & 0 deletions
56
lib/node_modules/@stdlib/math/base/special/gcdf/docs/types/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2019 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import gcdf = require( './index' ); | ||
|
||
|
||
// TESTS // | ||
|
||
// The function returns a number... | ||
{ | ||
gcdf( 8, 2 ); // $ExpectType number | ||
} | ||
|
||
// The compiler throws an error if the function is provided values other than two numbers... | ||
{ | ||
gcdf( true, 3 ); // $ExpectError | ||
gcdf( false, 2 ); // $ExpectError | ||
gcdf( '5', 1 ); // $ExpectError | ||
gcdf( [], 1 ); // $ExpectError | ||
gcdf( {}, 2 ); // $ExpectError | ||
gcdf( ( x: number ): number => x, 2 ); // $ExpectError | ||
|
||
gcdf( 9, true ); // $ExpectError | ||
gcdf( 9, false ); // $ExpectError | ||
gcdf( 5, '5' ); // $ExpectError | ||
gcdf( 8, [] ); // $ExpectError | ||
gcdf( 9, {} ); // $ExpectError | ||
gcdf( 8, ( x: number ): number => x ); // $ExpectError | ||
|
||
gcdf( [], true ); // $ExpectError | ||
gcdf( {}, false ); // $ExpectError | ||
gcdf( false, '5' ); // $ExpectError | ||
gcdf( {}, [] ); // $ExpectError | ||
gcdf( '5', ( x: number ): number => x ); // $ExpectError | ||
} | ||
|
||
// The compiler throws an error if the function is provided insufficient arguments... | ||
{ | ||
gcdf(); // $ExpectError | ||
gcdf( 3 ); // $ExpectError | ||
} |