How to deal with 32 bit and 64 bit integers in matlab?

I want to find out correlation coefficient. It need to do 64 or 32 bit integer addition,multiplication and square root. sqrt() doesn't support 32 bit integer. What is solution?

 채택된 답변

David Young
David Young 2014년 2월 16일
Just convert to double or single, using for example
y = sqrt(double(x));
Round the result and convert back to an integer if necessary.
Alternatively, write a square root function that uses purely integer arithmetic. It will probably be slow though. I'd do the conversion.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2014년 2월 16일

댓글:

2014년 2월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by