bitshift Double inputs error
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Lefteris Kostakis
il 24 Nov 2019
Modificato: Lefteris Kostakis
il 24 Nov 2019
I use this command where A is a 4x4 array and "s" is a dobule (actually it's value is 18.000)
I assume the inputs as int64, then why I get error "Double inputs must have integer values in the range of ASSUMEDTYPE" ?
W = bitshift(A,s-15,'int64');
whos A prints: " A 4x4 128 double "
Edit: I changed the command to "W = bitshift(int64(A),int64(s-15),'int64');"
But is the way to do it ?
0 Commenti
Risposta accettata
KALYAN ACHARJYA
il 24 Nov 2019
Modificato: KALYAN ACHARJYA
il 24 Nov 2019
A=randi(10,[4 4]);
s=18;
W = bitshift(A,s-15,'int64')
Result:
W =
40 56 32 72
32 16 80 72
64 8 80 48
64 48 24 72
Documentation: If A is an array of signed integers, then bitshift returns the arithmetic shift results, preserving the signed bit when k is negative, and not preserving the signed bit when k is positive.
See simmilar question here
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Operators and Elementary Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!