Is there a data type has higher precision than double?
34 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
In Matlab, I only know single, double two type of floating points number. Is there any type has higher precision? If not, is it possible to define one by myself?
0 commentaires
Réponses (2)
John D'Errico
le 2 Juin 2016
Modifié(e) : John D'Errico
le 2 Juin 2016
No, there is not a standard data type with higher precision than double.
Yes, you can use symbolic toolbox to get that. Or you can use my own HPF toolbox, downloadable from the file exchange.
And yes, of course, you CAN define your own class, providing higher precision. After all, that is exactly what I did when I wrote HPF. But then you would need to spend a significant amount of time to provide the accompanying code for all operations on those numbers. Everything from adds, multiplies, linear algebra, trig functions, etc. Whatever you use will need to be provided by you.
Or, you could use Java tools. But there too, only a few basic operations are defined. (Yes, I considered the Java ops when I wrote HPF. I had valid reasons for writing it myself.)
SHOULD you use higher precision? It is often the case (and this is said by a person who has written more than one high precision toolbox) that simple good numerical analysis is sufficient to avoid the need for high precision. Too often I think that people resort to high precision out of laziness, being unwilling to do the extra work to avoid the need. That is not to say that it is never necessary. HPF is fun to use and was a great deal of fun to write.
And don't forget that higher precision costs time. Any such tool will be WAY slower than double precision computations.
James Tursa
le 2 Juin 2016
You can use the Symbolic Toolbox VPA
Or you can use the HPF submission by John D'Errico:
0 commentaires
Voir également
Catégories
En savoir plus sur Logical 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!