@@ -290,6 +290,8 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
290
290
var xdt ;
291
291
var ydt ;
292
292
var zdt ;
293
+ var dt1 ;
294
+ var dt2 ;
293
295
var dt ;
294
296
var f ;
295
297
var N ;
@@ -380,20 +382,21 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
380
382
} ) ;
381
383
382
384
// Determine whether we need to cast the input ndarray...
383
- dt = binaryInputCastingDataType ( xdt , ydt , zdt , this . _policies . casting ) ;
384
- if ( xdt !== dt ) {
385
+ dt1 = binaryInputCastingDataType ( xdt , ydt , zdt , this . _policies . casting ) ;
386
+ dt2 = binaryInputCastingDataType ( ydt , xdt , zdt , this . _policies . casting ) ;
387
+ if ( xdt !== dt1 ) {
385
388
// TODO: replace the following logic with a call to `ndarray/base/(?maybe-)(cast|convert|copy)` or similar utility
386
- tmp = baseEmpty ( dt , shx , ordx ) ;
389
+ tmp = baseEmpty ( dt1 , shx , ordx ) ;
387
390
assign ( [ x , tmp ] ) ;
388
391
args [ 0 ] = tmp ;
389
- xdt = dt ;
392
+ xdt = dt1 ;
390
393
}
391
- if ( ydt !== dt ) {
394
+ if ( ydt !== dt2 ) {
392
395
// TODO: replace the following logic with a call to `ndarray/base/(?maybe-)(cast|convert|copy)` or similar utility
393
- tmp = baseEmpty ( dt , shy , ordy ) ;
396
+ tmp = baseEmpty ( dt2 , shy , ordy ) ;
394
397
assign ( [ y , tmp ] ) ;
395
398
args [ 1 ] = tmp ;
396
- ydt = dt ;
399
+ ydt = dt2 ;
397
400
}
398
401
// Resolve the lower-level strided function satisfying the input ndarray data type:
399
402
dtypes = [ resolveEnum ( xdt ) , resolveEnum ( ydt ) ] ;
@@ -485,6 +488,8 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
485
488
var xdt ;
486
489
var ydt ;
487
490
var tmp ;
491
+ var dt1 ;
492
+ var dt2 ;
488
493
var dt ;
489
494
var N ;
490
495
var f ;
@@ -569,20 +574,21 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
569
574
opts . dims = zeroTo ( N ) ;
570
575
}
571
576
// Determine whether we need to cast the input ndarray...
572
- dt = binaryInputCastingDataType ( xdt , ydt , getDType ( z ) , this . _policies . casting ) ; // eslint-disable-line max-len
573
- if ( xdt !== dt ) {
577
+ dt1 = binaryInputCastingDataType ( xdt , ydt , getDType ( z ) , this . _policies . casting ) ; // eslint-disable-line max-len
578
+ dt2 = binaryInputCastingDataType ( ydt , xdt , getDType ( z ) , this . _policies . casting ) ; // eslint-disable-line max-len
579
+ if ( xdt !== dt1 ) {
574
580
// TODO: replace the following logic with a call to `ndarray/base/(?maybe-)(cast|convert|copy)` or similar utility
575
- tmp = baseEmpty ( dt , shx , getOrder ( x ) ) ;
581
+ tmp = baseEmpty ( dt1 , shx , getOrder ( x ) ) ;
576
582
assign ( [ x , tmp ] ) ;
577
583
args [ 0 ] = tmp ;
578
- xdt = dt ;
584
+ xdt = dt1 ;
579
585
}
580
- if ( ydt !== dt ) {
586
+ if ( ydt !== dt2 ) {
581
587
// TODO: replace the following logic with a call to `ndarray/base/(?maybe-)(cast|convert|copy)` or similar utility
582
- tmp = baseEmpty ( dt , shy , getOrder ( y ) ) ;
588
+ tmp = baseEmpty ( dt2 , shy , getOrder ( y ) ) ;
583
589
assign ( [ y , tmp ] ) ;
584
590
args [ 1 ] = tmp ;
585
- ydt = dt ;
591
+ ydt = dt2 ;
586
592
}
587
593
// Resolve the lower-level strided function satisfying the input ndarray data type:
588
594
dtypes = [ resolveEnum ( xdt ) , resolveEnum ( ydt ) ] ;
0 commit comments