[Scilab-users] [Scilab-Dev] algebra conventions with integer types to be discussed
Samuel Gougeon
sgougeon at free.fr
Wed Sep 19 11:46:17 CEST 2018
Le 19/09/2018 à 11:24, Stéphane Mottelet a écrit :
> Le 19/09/2018 à 11:17, Samuel Gougeon a écrit :
>>
>> The current implementation is not incoherent.
> However, there are still bugs, and when trying to solve them, the
> question of incoherence raises. See e.g :
>
> --> int8(-128)/int8(-1)
> ans =
> -128
There is no bug here. The division yields 128, that then is wrapped,
what yields -128, since in Scilab after the int8 127, 127+1 goes to -128
instead of ceiling to 127 like in Octave:
>> int8(-128)/int8(-1)
ans = 127
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.
With both possible rules, wrapping or saturating ones, results may
appear as inconsistent. But for this example, it is not the case.
Samuel
More information about the users
mailing list