Bug 15184

classic Classic list List threaded Threaded
4 messages Options
Viktor Mileikovskyi Viktor Mileikovskyi
Reply | Threaded
Open this post in threaded view
|

Bug 15184

Dear Developers!

The bug 15184 has been successfully fixed in 6.0 branch but the master branch has the problem of segmentation fault if an operand of comparing operator is complex.
This cause danger of data loose and some SciLab programs to be highly unstable. The problem require additional tests before each "if" and inside each "while" statements degrading the code performance.
Please merge the bugfix to the master branch.

With best regards.
Viktor.

--
Skype: mileikovskyi
Mob: +38-044-2284247
Mob: +38-094-8284247


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Bug 15184

Le 14/08/2017 à 12:14, Viktor Mileikovskyi a écrit :
Dear Developers!

The bug 15184 has been successfully fixed in 6.0 branch
At least, the crash no longer occurs.
However, when we try to compare a complex to a real like with 2<%i, an error should be yielded instead of returning %F. Otherwise, the complementary comparison 2>=%i could be interpreted as %T, what is definitely not the case.
So: when such a comparison is done, we may test the existence of %s_1_s_custom() , that may be defined in an external way (%s_1_s() being already defined in Scilab).
 * If it exists: we call it
 * otherwise, we yield an error with a message inviting the user to define %s_1_s_custom()

I will propose a commit in this way, on the 6.0 branch.

Samuel


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Viktor Mileikovskyi Viktor Mileikovskyi
Reply | Threaded
Open this post in threaded view
|

Re: Bug 15184

Dear Samuel!

Many thanks!

For me there is no problem to run SciLab as admin, use edit %s_i_s (i=1:4) and add

else
    TF=%f

or

else
    error("Comparison of complex numbers is undefined")

etc.

The error is a good idea. It is more correct that in MatLab (comparing of the real part only). But %NAN is also possible, meaning that the operation can not provide any "logical number", 1 (%t) or 0 (%f).

If x<%i is false then x>=%i can also be false, such as x<%nan and x>=%nan. In this case, %f in "if" or "while" gives the same result but without changing of type of the comparing result from 4 to 1.

Nevertheless, %NAN is more correct (IMHO), especially in boolean expressions outside the "if" of "while" conditions. It is possible to use:

if a<b then
elseif a>=b then
else
    //a or/and b is/are %nan or complex.
end

With best regards.
Viktor.


14 серпня 2017, 14:38:33, від "Samuel Gougeon" <[hidden email]>:

Le 14/08/2017 à 12:14, Viktor Mileikovskyi a écrit :
Dear Developers!

The bug 15184 has been successfully fixed in 6.0 branch
At least, the crash no longer occurs.
However, when we try to compare a complex to a real like with 2<%i, an error should be yielded instead of returning %F. Otherwise, the complementary comparison 2>=%i could be interpreted as %T, what is definitely not the case.
So: when such a comparison is done, we may test the existence of %s_1_s_custom() , that may be defined in an external way (%s_1_s() being already defined in Scilab).
 * If it exists: we call it
 * otherwise, we yield an error with a message inviting the user to define %s_1_s_custom()

I will propose a commit in this way, on the 6.0 branch.

Samuel

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev



--
Skype: mileikovskyi
Mob: +38-044-2284247
Mob: +38-094-8284247


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Bug 15184

Le 14/08/2017 à 14:50, Viktor Mileikovskyi a écrit :
Dear Samuel!

Many thanks!

For me there is no problem to run SciLab as admin, use edit %s_i_s (i=1:4) and add

But it is a too specific status. Any user -- even not admin -- should be able to extend the overload without modifying native Scilab's code, even without write access to Scilab installation directory.


else
    TF=%f

or

else
    error("Comparison of complex numbers is undefined")

etc.

The error is a good idea. It is more correct that in MatLab (comparing of the real part only). But %NAN is also possible, meaning that the operation can not provide any "logical number", 1 (%t) or 0 (%f).

A boolean is expected as result. So we can't return %nan, that is of decimal type. In Scilab, unlike in Matlab (AFAIK), the boolean type is specific.
In addition, in boolean operations %nan does not propagate and is equivalent to %T:
--> [%f %t] & %nan
 ans  =
  F T

--> [%f %t] | %nan
 ans  =
  T T

This is why i will stick to issuing an error message. By the way, this is also the best way to make the user aware of the issue and informed on how overloading the comparison.

Thanks for your input.

Best regards
Samuel


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev