floating point arithmetics computing in quadruple precision
조회 수: 12 (최근 30일)
이전 댓글 표시
I try to use quadruple precision using the well know "double double" approach. Many operations seems correct however some results are wrong. To operate correctly it is necessary to avoid access 80bits register. Is it the case when running Matlab. Furthermore it would be very useful to use FMA operations which are available for AMD and Intel processors (FMA3). How to use these functions within Matlab.
Among strange results I cannot compute 1/6 with 31 correct digits. Perhaps because using double precision 6*(1/6)=1 exactly although 1/6 = 1.666666666666667e-01!!
Best regards
답변 (1개)
Jan
2021년 6월 25일
In Matlab 6.5 you could control the usage of the 80 bit registers:
% [UNTESTED in modern Matlab versions]
system_dependent('setprecision', 64) % Enable 80 bit registers
system_dependent('setprecision', 53) % Disable
At least on Intel CPUs using 64 bit registers was the default. I've experimented with this for XSum and a stable ACOS algorithm.
This might work also:
feature('SetPrecision', 64) % [UNTESTED in modern Matlab versions]
댓글 수: 3
Walter Roberson
2021년 6월 25일
Current MATLAB still accepts setprecision for system_dependent() and feature() . Whether it matters is a different question.
If I recall correctly, setprecision had no effect on calculations that were punted over to the high-speed libraries.. and also IIRC, the precision was reset at unpredicable times (because it was a change to the FCW and MATLAB assumed it was not necessary to preserve the FCW.)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!