![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/426463/image.jpeg)
Is it overflow?how can I input 2.5e-6?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/426388/image.jpeg)
1 commentaire
John D'Errico
le 24 Nov 2020
Modifié(e) : John D'Errico
le 24 Nov 2020
Moved answer by @Shaonong Wei into a comment.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/426463/image.jpeg)
If you want to add information to your question, then either edit your question or add a comment on your question.
Réponses (1)
Ameer Hamza
le 24 Nov 2020
Modifié(e) : Ameer Hamza
le 24 Nov 2020
This happens because of the way MATLAB parses the expression vpa(2.5e-6). First, MATLAB converts 2.5e-6 into a double datatype, and due to the finite precision of double(), you don't exactly get 2.5e-6. And only after that, MATLAB converts it to symbolic. In the second case, 2.5e-5 can be exactly represented, and thus, the problem does not occur. The workaround is to pass the 2.5e-6 as a char array
vpa('2.5e-6')
0 commentaires
Voir également
Catégories
En savoir plus sur Data Type Conversion 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!