필터 지우기
필터 지우기

Hi i have questions " i want function like unit 64 but generate 56 bit"

조회 수: 1 (최근 30일)
ghibeche
ghibeche 2022년 12월 30일
댓글: ghibeche 2022년 12월 30일
Hi i have questions " i want function like unit 64 but generate 56 bit"
  댓글 수: 5
John D'Errico
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
N = uint64 582622237229761
log2(double(N))
ans = 49.0496
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)
ans = '00000010000100011110010001001111011111010000001011000001'
ghibeche
ghibeche 2022년 12월 30일
Thank you for this information

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by