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!