フィルターのクリア

Computation's with large numbers.

10 ビュー (過去 30 日間)
Yuechuan Chen
Yuechuan Chen 2019 年 12 月 9 日
コメント済み: Yuechuan Chen 2019 年 12 月 9 日
So, I'm trying to divide n-1( n=94315998522576010519588224930693232398146802027362761139521) by 2^143, I stored n has a symbolic variable to not lose precision, so:
n=sym('94315998522576010519588224930693232398146802027362761139521');
however, when I do n-1/2^143 it gives me a stupid answer 1051658525598479156308916018992636883668880484184809306202701679900748001639266703538773119682234810367/11150372599265311570767859136324180752990208 (the correct answer should be 8458551289020639 ) .
It seems like Matlab has treated n-1/2^143 as a string rather than a computation because it's outputing the / sign.
I've also tried vpa but I encountered the same problem.
Could someone shed a light on this please, how can I compute this without losing accuracy, i.e. preventing Matlab rounding n and my answer.
THANKS!

採用された回答

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 12 月 9 日
n=sym('94315998522576010519588224930693232398146802027362761139521');
answer=vpa((n-1)/2^143)
  1 件のコメント
Yuechuan Chen
Yuechuan Chen 2019 年 12 月 9 日
Perfect! Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by