[Scilab-users] Scilab and Matlab integer representation

Samuel Gougeon sgougeon at free.fr
Tue Aug 5 14:54:31 CEST 2014


About that:
Le 05/08/2014 08:35, A Khorshidi a écrit :
> .../...
> And another case,
> For values larger than the maximum value of a given integer data type 
> (e.g. 127 for int8) Scilab and Matlab return different values.
> For example, Scilab's result for int8(200) is -56 but Matlab's result 
> will be 127 (the largest value which can be stored in this data type).

Scilab wraps integer overflows (200 - 2^8 = -56), whereas Octave 
saturates. When overflowing an integer, "R" delivers a "NA" value (Not 
Available).
I have no opinion about the best way to deal with integer overflow when 
designing the language.
This kind of topic has been discussed when designing the bitshift() 
function for Scilab:
http://bugzilla.scilab.org/show_bug.cgi?id=9006#c8

Regards
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140805/cab9952c/attachment.htm>


More information about the users mailing list