Computation's with large numbers.
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yuechuan Chen
am 9 Dez. 2019
Kommentiert: Yuechuan Chen
am 9 Dez. 2019
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!
0 Kommentare
Akzeptierte Antwort
JESUS DAVID ARIZA ROYETH
am 9 Dez. 2019
n=sym('94315998522576010519588224930693232398146802027362761139521');
answer=vpa((n-1)/2^143)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!