[Scilab-users] array constructors

Samuel Gougeon sgougeon at free.fr
Tue Oct 2 20:31:16 CEST 2018


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

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


More information about the users mailing list