[scilab-Users] problem with clause "double" of sum function ?

Serge Steer Serge.Steer at inria.fr
Thu Aug 11 15:06:02 CEST 2011


Le 11/08/2011 12:14, CRETE Denis a écrit :
> Hello,
> I am puzzled by the behaviour of this piece of code: 
>
> N=21;M=4;
> A=floor(256*rand(N,M)); 	// Build random matrix 
> B=uint8(A);				// Conversion to integer 
> max(abs(sum(B,2,"double")-sum(A,2)))	// Should return 0
>
> It returns 0 for specific values of (N,M), e.g. when (N<14,M<4) and when (N<7*M-7,M>=4) !?!
>   
Strange...

I made the following test on my Linux box with Scilab-5.3.2 and
encountered no problem:
M=100;N=100;
R=ones(M,N);
for m=1:M;
  for n=1:N;
    A=floor(256*rand(n,m));
    B=uint8(A);
    R(m,n)=max(abs(sum(B,2,"double")-sum(A,2)));
  end
end
find(R<>0)

Should it be a windows specific problem?
> (I am using Scilab 5.3.2 on PC/Windows XP)
>
> The manual says that the first argument of "sum" is an array of real, complex, boolean, polynoms or rational fractions: does it mean that integers are excluded ? 
It is a bug in the manual
> Why ?
> Thanks for any explanation
> Denis
>
>   




More information about the users mailing list