Increase precision of calculation
이전 댓글 표시
Hi everyone, I'm experiencing the following wierd situation. I'm executing the same piece of Matlab code in two different PCs (in fact one is my Desktop and the other is the Cluster of our university). In my program I'm saving at some point a variable K. Then if I type in my desktop the command "num2str(K(1,1),'%.20f'') to display the elements of K calculated from the desktop I'm getting the following 33857.67157806616200000000 the same command for the variable K calculated from the Cluster and transfered to my desktop gives 33857.67157806647400000000. In the Cluster I have the option to launch octave (unfortunatelly I cannot do with Matlab in the CLuster) and type the same command and I get 33857.67157806647446705028 which seems to be most accurate. Since both both systems (my desktop and the Cluster) run Matlab whats going on with the Matlab on my desktop is there any way to increase the precision.
Thank you
Giorgos
(Just in case you might wonder why it is so important, K is nearly singular and these very insigificant differences become very large at operations like x=K\b. )
답변 (2개)
Walter Roberson
2012년 6월 1일
0 개 추천
Giorgos Kourakos
2012년 6월 4일
0 개 추천
댓글 수: 1
Walter Roberson
2012년 6월 4일
The math libraries are not going to be exactly the same for the two operating systems, partly because the compilers optimize differently.
The standard output libraries for Windows apparently do not print long floating point numbers correctly. The libraries for Linux should be able to print in full precision with a %.40f format
카테고리
도움말 센터 및 File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!