Hi i have questions " i want function like unit 64 but generate 56 bit"
1 次查看(过去 30 天)
显示 更早的评论
Hi i have questions " i want function like unit 64 but generate 56 bit"
5 个评论
John D'Errico
2022-12-30
Sorry, but there is no uint56 data type in MATLAB. Could you create one? Well yes. But then you would also need to program ALL interactions with that datatype. How to add, subtract, multiply, divide, display the numbers, etc.
Far better to just use uint64.
What the code you wrote is suposed to do, I am not at all sure. Are you trying to extract the bits? For example...
N = uint64(17)^12
log2(double(N))
This is an integer smaller than 2^56, since the log base 2 is approximately 49.
And dec2bin can extract the desired 56 bits. There are leading zero bits, but that is what you want.
dec2bin(N,56)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!