[Scilab-users] Scilab and Matlab integer representation

A Khorshidi akhorshidi at live.com
Tue Aug 5 16:34:11 CEST 2014


Thank you All; 


aweeks wrote
> http://wiki.scilab.org/Tutorials?action=AttachFile&do=view&target=Scilab4Matlab.pdf
> 	page 18

Yes, this document point out the second case nice. 



Dang, Christophe wrote
> The only "right" answer would be a special value, indicating the overflow.

Yes, exactly. 


Dang, Christophe wrote
> but int8  represent few values (256), who would waste one value to
> implement an error code?

Really who? ;) 



Samuel GOUGEON wrote
> If you do the same test for a large matrix, the memory used becomes 
> asymptotically proportionnal to the matrix size:

But how much proportional? 

According to the link you provided, we reach to the golden formula below to
compute the amount the memory used by a Scilab variable: 
for doubles data type:
Number_of_Bytes = Bytes_of_Header + Array_Dim * Bytes_of_theDataType

for integer data type:
Number_of_Bytes = Bytes_of_Header + Array_Dim * Bytes_of_theDataType +
An_Unknown_Amount

What do you think of the "An_Unknown_Amount"? 
Although that document describe doubles, booleans, string, polynomials, ...
in detail, we cannot find anything about integer data types. 

So let me continue with some example: 


-->Doubles = [ 1 , 2 , 3 ; 4 , 5 , 6 ];   
-->whos -name Doubles
Name                     Type           Size           Bytes        
Doubles                  constant       2 by 3         64

-->Number_of_Bytes = (4*4) + (size(Doubles,'*')*8) 
 Number_of_Bytes  =
     64.   


	 
-->Integers = int8([ 1 , 2 , 3 ; 4 , 5 , 6 ]);
-->whos -name Integers
Name                     Type           Size           Bytes        
Integers                 int8           2 by 3         24           

-->Number_of_Bytes = (4*4) + (size(Integers,'*')*1) 
 Number_of_Bytes  =
     22. 	 

Then we have An_Unknown_Amount = 24-22=2 

So the question is, 
What is the "An_Unknown_Amount"? 


Merci, 
Mehran
_




--
View this message in context: http://mailinglists.scilab.org/Scilab-users-Scilab-and-Matlab-integer-representation-tp4031002p4031007.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list