[Scilab-users] [Scilab-Dev] algebra conventions with integer types to be discussed

Samuel Gougeon sgougeon at free.fr
Wed Sep 19 12:25:35 CEST 2018


Le 19/09/2018 à 12:02, Stéphane Mottelet a écrit :
> Le 19/09/2018 à 11:46, Samuel Gougeon a écrit :
> .../...
>>
>> At first sight, Octave's result does not look more consistent than 
>> Scilab's one.
>> But following its own ceiling/flooring rules, yet it is consistent.
> What is puzzling is that Scilab implements a *mix* of rules comming 
> from different software. I am wondering about the true reason:
>
> Scilab:
>
> --> int8(-128)/int8(0)
>  ans  =
>
>  -128

This is in Scilab 6. In Scilab 6, int8(-%inf) has been set to the int8 
floor, and int8(%inf) to the int8 ceil. It is more consistent than the 
5.5 behavior (and is now documented in the 6.0 branch).
Also, 6.0 uses ieee() in a consistent way for encoded integers. That was 
not the case with Scilab 5.5. This change would deserve being documented.

So here, the sign is correct, the value as well.

>
> --> int8(-128)/int8(-1)
>  ans  =
>  -128
>
> Matlab:
>
> >> int8(-128)/int8(0)
>
> ans =
>
>   int8
>
>    -128
>
> >> int8(-128)/int8(-1)
>
> ans =
>
>   int8
>
>    127

All these results are consistent in their own referential.
I don't catch where you see a mix of rules.

It is anyway necessary to set a fixed value for int8(%inf) and 
int8(-%inf). These inputs are not "infinitely wrappable" :)
To set them to the bounding values is not absurd. This is what Scilab 
6.0 does now. To me, it is an improvement.

Samuel




More information about the users mailing list