Skip to content

Commit d28ccce

Browse files
Update index.js
Signed-off-by: Harsh Mathur <[email protected]>
1 parent d212d48 commit d28ccce

File tree

1 file changed

+5
-12
lines changed
  • lib/node_modules/@stdlib/math/base/special/lcmf/examples

1 file changed

+5
-12
lines changed

lib/node_modules/@stdlib/math/base/special/lcmf/examples/index.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,13 @@
1919
'use strict';
2020

2121
var linspace = require( '@stdlib/array/base/linspace' );
22+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2223
var lcmf = require( './../lib' );
2324

24-
var nValues = linspace( 1.0, 20.0, 20 );
25+
var numsA = linspace( 1.0, 10.0, 10 );
26+
var numsB = discreteUniform( 100, 0, 10 );
2527

26-
// Iterate through the values and compute the LCM of two numbers
2728
var i;
28-
for ( i = 0; i < nValues.length - 1; i++ ) {
29-
var a = nValues[i];
30-
var b = nValues[i + 1];
31-
32-
// Ensure a and b are single-precision floating-point numbers (float32)
33-
if ( typeof a === 'number' && typeof b === 'number' ) {
34-
console.log( 'LCM of %d and %d = %d', a, b, lcmf( a, b ) );
35-
} else {
36-
console.log( 'Invalid input types. Both a and b should be single-precision floating-point numbers.' );
37-
}
29+
for ( i = 0; i < numsA.length; i++ ) {
30+
console.log( 'lcmf(%d, %d) = %d', numsA[ i ], numsB[ i ], lcmf( numsA[ i ], numsB[ i ] ) );
3831
}

0 commit comments

Comments
 (0)