how to convert a number in exponential form to normal decimal form?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
K Kaushik Subudhi
le 6 Juin 2018
Modifié(e) : Stephen23
le 6 Juin 2018
I am trying to get the complete value of the number which is in exponential form but its not showing the complete value. I have tried below:
Code:
format long
pmod=hex2dec('DB7C2ABF62E35E668076BEAD208B');
fprintf('\n%.f',pmod);
Output : 4451685225093714900000000000000000
but the correct output should be 4451685225093714772084598273548427
Is there any other method to get the complete value?
0 commentaires
Réponse acceptée
Stephen23
le 6 Juin 2018
Modifié(e) : Stephen23
le 6 Juin 2018
That value is far too large to store in a double without loss of precision. You will need to use a custom data class, a symbolic variable, or store the output digits in a char vector. If you are okay with having the output digits in a char vector then you can download John D'Errico's excellent base2base function:
>> base2base('DB7C2ABF62E35E668076BEAD208B',16,10)
ans = 4451685225093714772084598273548427
You could easily convert the output of base2base to a symbolic variable.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numeric Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!