MATLAB Smallest Integer in floating point number system
이전 댓글 표시
I am interested in finding the smallest integer in MATLAB, say y, that is not representable in 64 bit floating point format so that the floating point number is not equal to y i.e., fl(y) is not y.
My insticts tells me that could be the underflow level given as 2^-1022 and its corresponding floating point number is 1.00...2^{-1022}
I don't whether this is correct. Help me find the number please.
채택된 답변
추가 답변 (1개)
You are indeed correct:
realmin,log2(realmin)
Unless you actually mean integer, in which case the smallest integer is 0.
If you mean the lowest number of an IEEE double: that would be
-realmax
댓글 수: 8
Hmm!
2021년 1월 26일
Rik
2021년 1월 26일
Do you mean what the binary representation would be?
If it isn't representable that means you can't write it.
This is the binary for the smallest number you can write with a double:
b=dec2bin(typecast(realmin,'uint64'),64);
fprintf('S E F\n%s %s %s\n',b(1),b(2:12),b(13:end))
If you want anything smaller you will need to use a quad or vpa. Anything between 0 and realmin can't be written as a double.
Rik
2021년 1월 26일
Yes. I typecast it to a 64 bit integer and converted that to a 64 digit binary number. I added two spaces and a header to explain what the numbers are.
Hmm!
2021년 1월 27일
Anything between 0 and realmin can't be written as a double.
Incorrect. realmin is the smallest normalized positive value, but there are smaller subnormal positive values.
x = realmin
y = eps(0)
y < x
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!