[Scilab-users] array constructors

Heinz Nabielek heinznabielek at me.com
Tue Oct 2 21:02:21 CEST 2018


On 02.10.2018, at 20:31, Samuel Gougeon <sgougeon at free.fr> wrote:
> 
> Le 02/10/2018 à 18:37, Adelson Oliveira a écrit :
>> Hi,
>> 
>> In scilab 6.1, I've noticed that the array
>> 
>> [8.9:0.2:9.9] does contain 8.9 and 9.9,
>> 
>> but the array,
>> 
>> [-5.1:0.2:5.1]
>> 
>> does not contain the last element 5.1!
>> 
>> find([-5.1:0.2:5.1] == 5.1) = []
>> 
>> Why is that?
>> 
>> Isn't it a bug?
> 
> We have
> --> a = -5.1:0.2:5.1;
> --> delta = a($)+0.2-5.1
>  delta  = 
>    8.882D-16
> 
> --> delta/5.1/%eps
>  ans  =
>    0.7843137
> 
> So, computing the next value leads to 5.1 but with an excess within the epsilon machine.
> Because of this excess, this last value is not included in the output set.
> 
> I am wondering whether we could detect this kind of edge effects, and manage them more softly.
> 
> Samuel


UNDERSTOOD. But what is a safe way to plot histograms like histplot(a:b:c, X) where X is a one-dimensional array?
Heinz


More information about the users mailing list