Is there a way to avoid this inaccuracy when converting an string to a double and then to an unsigned int? I have tried using str2num() but get the same result.Thanks!
조회 수: 3 (최근 30일)
이전 댓글 표시
uint64(str2double('132697151393876469'))
%ans =
% uint64
% 132697151393876464
% note that the ans is the same for inputs 1326971513938764XX, where XX is in the range (57-71)
댓글 수: 0
채택된 답변
추가 답변 (1개)
the cyclist
2021년 9월 28일
The reason for this is that MATLAB uses double-precision arithmetic by default, which will typically give approximately 15 decimal digits of precision.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!