-
Notifications
You must be signed in to change notification settings - Fork 4
compute gcd
kgryte edited this page May 12, 2015
·
1 revision
Computes the greatest common divisor (gcd) of two or more integers
.
var val = compute.gcd( [48, 18] );
// returns 6
For object arrays
, provide an accessor function
for accessing array
values
var data = [
{'x':48},
{'x':18},
{'x':30}
];
function getValue( d, i ) {
return d.x;
}
var val = compute.gcd( data, getValue );
// returns 6
If provided an array
with a length less than 2
, the method returns null
.
Note: the method also provides a variadic interface. See compute-gcd for additional details.
- Utilities
- Array Creation
- Sorting and Reshaping Arrays
- Special Functions
- Arithmetic
- Relational Operations
- Logical Operations
- Trigonometry
- Geometry
- Sets
- Discrete Mathematics
- Linear Algebra
- Statistics