How to use the small positive float number?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi everyone
I am writing the code in which I need to deal with quite small number like
A = (1/2^8)^512
When I run this line, matlab gives back 0 as the results. However, I need this number to be multiplied with other big numbers.
How can I save the real value of variable A?
Many thanks,
Regards
0 件のコメント
回答 (1 件)
Guillaume
2015 年 5 月 15 日
編集済み: Guillaume
2015 年 5 月 15 日
In plain matlab, you cannot represent such a number as it's way outside the range that a double can represent. The exponent part of a double is 11 bits, offset by 1023, so the minimum number that can be represented by a double is around 2^-1023 (the true minimum is 2^-1074), your number is 2^-4096!
You would have to use vpa from the Symbolic math toolbox (I know nothing about it, I don't have it), or go through Java's BigDecimal, or look through the file exchange for an arbitrary precision type.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!