Cannot subtract number of order smaller then e-4 from variable
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
a=0.1; a=a-1e-5 gives result a=0.1000
댓글 수: 0
채택된 답변
  Torsten
      
      
 2024년 11월 26일
        
      편집: Torsten
      
      
 2024년 11월 26일
  
      It's just a question of how the numbers are displayed. 
Internally, the precision of computing is much higher.
format long  % Use display format long
a = 0.1;
a = a - 1e-5
format short
a
댓글 수: 3
  Walter Roberson
      
      
 2024년 11월 26일
				
      편집: Walter Roberson
      
      
 2024년 11월 26일
  
			format long  % Use display format long
a = 0.1;
fprintf('%.999g\n', a)
a = a - 1e-5
fprintf('%.999g\n', a)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


