필터 지우기
필터 지우기

Single versus double precision, what's going on here?

조회 수: 2 (최근 30일)
Matt H
Matt H 2013년 7월 23일
Why does: >> 14+18300+200000+5000000+550000000
ans =
555218314
But: >> single(14)+single(18300)+single(200000)+single(5000000)+single(550000000)
ans =
555218304
Am I missing something? Thanks!
  댓글 수: 1
Matt H
Matt H 2013년 7월 23일
Answer: In single precision, the fraction only contains 23 bits, so there 2^(23+1) for the maximum value, before you start losing precision at the integer level. So 2^24 = 16777216. >> single(16777216)
ans =
16777216
>> single(16777217)
ans =
16777216

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

채택된 답변

dpb
dpb 2013년 7월 23일
Hint--(a very large one :) )
single(550000000)+single(5000000)+single(200000)+single(18300)
ans = ???

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by