Hi All !
According to the scilab help, the %eps value is a constrain that represent the machine precision, so i thought it was different between 32 bits machines and the 64 bits ones, but no :-s I have Scilab 4.0.1 on a 32bits Windows machine and the %eps is 2.220D-16 My surprise was when i mounted Scilab 5.0.3 over a 64 bits Ubuntu 8.10 machine and got the same result :-? Anyone knows why %eps is the same and how i can compute an algorithm with more precision? Greetings and thanks in advice -- Sofia Mamian |
Michael Baudin |
Hi,
Scilab real values are based on double precision i.e. floating point values which are stored on 64 bits. This has nothing to do with the 32/64 bits of the machine, which refer to the way the memory is addressed. See the wikipedia page for more details : http://en.wikipedia.org/wiki/64-bit#32_vs_64_bit Note that this is a good thing for Scilab users, since it guarantees that the results are the same, whatever the platform used. Furthermore, since Scilab 5., the double precision is used whatever the OS used : http://www.scilab.org/changes_5/#numerical_precision "Numerical precision of Scilab under Linux 32 bits has been switched to double precision (53 bits). Therefore, the precision on some specific computations is improved and the consistency between Microsoft Windows & GNU/Linux enhanced. " The following is, by the way, a short algorithm to compute eps. In Scilab, this algorithm is performed by the routine DLAMCH, from Lapack. The algorithm requires 53 iterations to perform, because this is the number of bits (+1) which are required to store the fractionnal part of a double precision floating point number (i.e. the size of the mantissa). eps = 1.0; done = 0; i = 0; while done==0 eps = eps / 2.0; if (1.0+eps==1.0) then done = 1; end i = i + 1; end eps = eps * 2; mprintf("i=%d", i); mprintf("eps=%e", eps); The reference for this is the paper by Malcom : "Algorithms to Reveal Properties of Floating-Point Arithmetic" Michael A. Malcolm Stanford University Communications of the ACM Volume 15 , Issue 11 (November 1972) Pages: 949 - 951 and its complement : "More on Algorithms that Reveal Properties of Floating Point Arithmetic Units" W. Morven Gentleman, University of Waterloo Scott B. Marovich, Purdue University Communications of the ACM Volume 17 , Issue 5 (May 1974) Pages: 276 - 277 Best regards, Michaël Baudin esmamian a écrit : > Hi All ! > According to the scilab help, the %eps value is a constrain that > represent the machine precision, so i thought it was different between > 32 bits machines and the 64 bits ones, but no :-s > > I have Scilab 4.0.1 on a 32bits Windows machine and the %eps is 2.220D-16 > My surprise was when i mounted Scilab 5.0.3 over a 64 bits Ubuntu 8.10 > machine and got the same result :-? > > Anyone knows why %eps is the same > and how i can compute an algorithm with more precision? > > Greetings and thanks in advice > > -- > Sofia Mamian |
Free forum by Nabble | Edit this page |