필터 지우기
필터 지우기

How to calculate the largest real number in IEEE double and single precision representation.

조회 수: 1 (최근 30일)
How do you calculate (in your own way) the largest real number in IEEE double and single precision representations wihtout using realmax('single') and realmax('double')? thank you!
  댓글 수: 2
Matt Kindig
Matt Kindig 2013년 5월 15일
Wikipedia gives a pretty good overview of how to do so in its article:
I happened to have been reading this article just today.
James Tursa
James Tursa 2013년 5월 15일
Using just floating point operations? Or allowing for bit manipulation and type casting?

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

답변 (1개)

Jan
Jan 2013년 5월 15일
편집: Jan 2013년 5월 15일
Using the bit-patterns defined e.g. here http://docs.oracle.com/cd/E19957-01/806-3568/ncg_math.html and a typecast should be sufficient. Because IEEE754 is a convention, there is nothing wrong with using the bit-patterns defined in this convention directly.
[EDITED] What about pow2(2 - eps, 1023)? Does this reply the correct answer?
  댓글 수: 2
José-Luis
José-Luis 2013년 5월 15일
편집: José-Luis 2013년 5월 15일
It should give the correct answer since that is the formula invoked by realmax. Without using eps:
pow2(1 + (1 - 2^-52),1023) == realmax
Or even without pow2:
(1 + (1 - 2^-52))*2^1023 == realmax
Speedwise it might not be optimal but William seemed reluctant to use built-in functions.
Jan
Jan 2013년 5월 15일
편집: Jan 2013년 5월 15일
@Jose-Luis: Thanks for explaining this. I do not have access to Matlab currently, otherwise I had taken a look into edit realmax.

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

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by