필터 지우기
필터 지우기

Matlab returns Inf for 10^1000.

조회 수: 13 (최근 30일)
David
David 2013년 10월 10일
답변: John D'Errico 2013년 10월 10일
Why is 10^1000 unrepresentable in Matlab?

채택된 답변

Walter Roberson
Walter Roberson 2013년 10월 10일
MATLAB uses IEEE 754 Double Precision Floating Point. The maximum representable value is approximately 1E+308
The File Exchange has an extended precision integer tool.
The Symbolic Toolbox represents values with potentially longer precision. I am not certain what the limit is; 10^10000 possibly, maybe higher.
  댓글 수: 2
David
David 2013년 10월 10일
Is there a formula for calculating the largest storable value by a n bit long string? Like, for single it's 2^31 - 1. Or, have I been misinformed?
Roger Stafford
Roger Stafford 2013년 10월 10일
편집: Roger Stafford 2013년 10월 10일
In IEEE 754 double precision floating point numbers the largest possible finite number representable is 2^1024*(1-2*(-53)) and is called 'realmax'. The total bit string which represents these numbers is 64 bits long with one bit for the sign, 11 bits for the exponent, and 53 bits, one of which is implicit ("hidden"), for the significand (mantissa).
(Corrected)

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

추가 답변 (2개)

John D'Errico
John D'Errico 2013년 10월 10일
As Per and Roger have explained, the issue is that a double only goes so far. Floating point numbers use a fixed number of bits to encode any number within reasonable limits. However, some numbers are just too big. For them, you need a tool in matlab that is designed to handle them. Thus
sym('10^1000')
ans =
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
My HPF can do it too.
hpf('1e1000',100)
ans =
1.e1000
As well as my vpi tool, or the enhanced version of that tool, vpij.
vpi(10)^1000
ans =
10000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
So MATLAB CAN represent that number, but only if you use the proper data type.

per isakson
per isakson 2013년 10월 10일
편집: per isakson 2013년 10월 10일
Because
>> realmax( 'double' )
ans =
1.7977e+308

카테고리

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