Can I have higher precision while counting with long numbers?

조회 수: 2 (최근 30일)
Jakub Závada
Jakub Závada 2015년 5월 1일
댓글: Stephen23 2015년 5월 2일
I wrote function for the number of non-isomorphic graphs on n vertices using Burnside lemma. Function returns correct numbers only for n<14. But for n=14 it returns 29054155657235472 instead of 29054155657235488 and for n>14 there are lots of zeros at the end of the number. I got correct number when I tried to count it for n=14 with the same algorithm in Maple, so algorithm should be right.
And if I can get higher precision, how can I display whole number instead of 3.1426e+19 for n=15 etc?
  댓글 수: 1
Stephen23
Stephen23 2015년 5월 2일
@Jakub Závada: this precision limit exists because MATLAB uses the IEEE 754 floating point classes "double" and "single", which of course have a finite precision. This clearly documented and is expected behavior for any numeric calculation, language or program that ueses these data classes:
https://en.wikipedia.org/wiki/Double-precision_floating-point_format
Numeric computation is not the same thing as symbolic calculation!

댓글을 달려면 로그인하십시오.

답변 (1개)

James Tursa
James Tursa 2015년 5월 1일
If you have the symbolic toolbox you can use vpa. If not, then you might look into these two FEX submissions by John D'Errico:

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by