Is there a data type has higher precision than double?
이전 댓글 표시
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?
답변 (2개)
John D'Errico
2016년 6월 2일
편집: John D'Errico
2016년 6월 2일
1 개 추천
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
2016년 6월 2일
0 개 추천
You can use the Symbolic Toolbox VPA
Or you can use the HPF submission by John D'Errico:
카테고리
도움말 센터 및 File Exchange에서 Argument Definitions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!