Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Feb 6, 2024
1 parent 9d86997 commit afe192a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 72 deletions.
10 changes: 4 additions & 6 deletions base/assert/is-mostly-safe-data-type-cast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,17 @@ bool = isMostlySafeCast( 'float64', 'int32' );
<!-- eslint no-undef: "error" -->

```javascript
var cartesianSquare = require( '@stdlib/array/base/cartesian-square' );
var cartesianSquare = require( '@stdlib/array/cartesian-square' );
var dtypes = require( '@stdlib/ndarray/dtypes' );
var isMostlySafeCast = require( '@stdlib/ndarray/base/assert/is-mostly-safe-data-type-cast' );

// Generate a list of dtype pairs:
var pairs = cartesianSquare( dtypes() );
var dt = cartesianSquare( dtypes() );

// For each data type pair, determine whether one can cast to another data type...
var dt;
var i;
for ( i = 0; i < pairs.length; i++ ) {
dt = pairs[ i ];
console.log( '%s => %s. Can cast? %s.', dt[ 0 ], dt[ 1 ], isMostlySafeCast( dt[0], dt[1] ) );
for ( i = 0; i < dt.length; i++ ) {
console.log( '%s. Can cast? %s.', dt[i].join( ' => ' ), isMostlySafeCast.apply( null, dt[i] ) );
}
```

Expand Down
10 changes: 4 additions & 6 deletions base/assert/is-mostly-safe-data-type-cast/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@

'use strict';

var cartesianSquare = require( '@stdlib/array/base/cartesian-square' );
var cartesianSquare = require( '@stdlib/array/cartesian-square' );
var dtypes = require( './../../../../dtypes' );
var isMostlySafeCast = require( './../lib' );

// Generate a list of dtype pairs:
var pairs = cartesianSquare( dtypes() );
var dt = cartesianSquare( dtypes() );

// For each data type pair, determine whether one can cast to another data type...
var dt;
var i;
for ( i = 0; i < pairs.length; i++ ) {
dt = pairs[ i ];
console.log( '%s => %s. Can cast? %s.', dt[ 0 ], dt[ 1 ], isMostlySafeCast( dt[0], dt[1] ) );
for ( i = 0; i < dt.length; i++ ) {
console.log( '%s. Can cast? %s.', dt[i].join( ' => ' ), isMostlySafeCast.apply( null, dt[i] ) );
}
22 changes: 7 additions & 15 deletions base/assert/is-safe-data-type-cast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,17 @@ bool = isSafeCast( 'float64', 'int32' );
<!-- eslint no-undef: "error" -->

```javascript
var cartesianSquare = require( '@stdlib/array/cartesian-square' );
var dtypes = require( '@stdlib/ndarray/dtypes' );
var isSafeCast = require( '@stdlib/ndarray/base/assert/is-safe-data-type-cast' );

var DTYPES;
var bool;
var dt;
// Generate a list of dtype pairs:
var dt = cartesianSquare( dtypes() );

// For each data type pair, determine whether one can safely cast from one data type to another...
var i;
var j;

// Get a list of supported ndarray data types:
DTYPES = dtypes();

// For each data type, determine whether one can safely cast to another data type...
for ( i = 0; i < DTYPES.length; i++ ) {
dt = DTYPES[ i ];
for ( j = 0; j < DTYPES.length; j++ ) {
bool = isSafeCast( dt, DTYPES[ j ] );
console.log( '%s => %s. Safe? %s.', dt, DTYPES[ j ], bool );
}
for ( i = 0; i < dt.length; i++ ) {
console.log( '%s. Safe? %s.', dt[i].join( ' => ' ), isSafeCast.apply( null, dt[i] ) );
}
```

Expand Down
22 changes: 7 additions & 15 deletions base/assert/is-safe-data-type-cast/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,15 @@

'use strict';

var cartesianSquare = require( '@stdlib/array/cartesian-square' );
var dtypes = require( './../../../../dtypes' );
var isSafeCast = require( './../lib' );

var DTYPES;
var bool;
var dt;
var i;
var j;

// Get a list of supported ndarray data types:
DTYPES = dtypes();
// Generate a list of dtype pairs:
var dt = cartesianSquare( dtypes() );

// For each data type, determine whether one can safely cast to another data type...
for ( i = 0; i < DTYPES.length; i++ ) {
dt = DTYPES[ i ];
for ( j = 0; j < DTYPES.length; j++ ) {
bool = isSafeCast( dt, DTYPES[ j ] );
console.log( '%s => %s. Safe? %s.', dt, DTYPES[ j ], bool );
}
// For each data type pair, determine whether one can safely cast from one data type to another...
var i;
for ( i = 0; i < dt.length; i++ ) {
console.log( '%s. Safe? %s.', dt[i].join( ' => ' ), isSafeCast.apply( null, dt[i] ) );
}
22 changes: 7 additions & 15 deletions base/assert/is-same-kind-data-type-cast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,17 @@ bool = isSameKindCast( 'uint16', 'int16' );
<!-- eslint no-undef: "error" -->

```javascript
var cartesianSquare = require( '@stdlib/array/cartesian-square' );
var dtypes = require( '@stdlib/ndarray/dtypes' );
var isSameKindCast = require( '@stdlib/ndarray/base/assert/is-same-kind-data-type-cast' );

var DTYPES;
var bool;
var dt;
// Generate a list of dtype pairs:
var dt = cartesianSquare( dtypes() );

// For each data type pair, determine whether one can cast from one data type to another...
var i;
var j;

// Get a list of supported ndarray data types:
DTYPES = dtypes();

// For each data type, determine whether one can cast to another data type...
for ( i = 0; i < DTYPES.length; i++ ) {
dt = DTYPES[ i ];
for ( j = 0; j < DTYPES.length; j++ ) {
bool = isSameKindCast( dt, DTYPES[ j ] );
console.log( '%s => %s. Allowed cast? %s.', dt, DTYPES[ j ], bool );
}
for ( i = 0; i < dt.length; i++ ) {
console.log( '%s. Allowed cast? %s.', dt[i].join( ' => ' ), isSameKindCast.apply( null, dt[i] ) );
}
```

Expand Down
22 changes: 7 additions & 15 deletions base/assert/is-same-kind-data-type-cast/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,15 @@

'use strict';

var cartesianSquare = require( '@stdlib/array/cartesian-square' );
var dtypes = require( './../../../../dtypes' );
var isSameKindCast = require( './../lib' );

var DTYPES;
var bool;
var dt;
var i;
var j;

// Get a list of supported ndarray data types:
DTYPES = dtypes();
// Generate a list of dtype pairs:
var dt = cartesianSquare( dtypes() );

// For each data type, determine whether one can cast to another data type...
for ( i = 0; i < DTYPES.length; i++ ) {
dt = DTYPES[ i ];
for ( j = 0; j < DTYPES.length; j++ ) {
bool = isSameKindCast( dt, DTYPES[ j ] );
console.log( '%s => %s. Allowed cast? %s.', dt, DTYPES[ j ], bool );
}
// For each data type pair, determine whether one can cast from one data type to another...
var i;
for ( i = 0; i < dt.length; i++ ) {
console.log( '%s. Allowed cast? %s.', dt[i].join( ' => ' ), isSameKindCast.apply( null, dt[i] ) );
}

0 comments on commit afe192a

Please sign in to comment.