Evaluation of complex numbers with imaginary part equals to 0 should set them as real
Reported by Pierre-Aime AGNEL
BUG DESCRIPTION:
----------------
Scilab considers a number not real when there exists an imaginary part even if the imaginary part is zero.
Some considerations
// SCRIPT START
a = 2 + 0*%i;
isreal(a) == %f // even if the imaginary part is zero
tol = %eps;
isreal(a, tol) == %t
// isreal has a tolerance argument that allow to consider a number numerically real
// if the imaginary part is lower than the tolerance
// script that follow is most likely
// if isreal(a, tol)
// a = real(a)
// end
a <= 2 // yields to an error
a == 2 // yields to %t
// SRIPT END
In my opinion, numbers having a imaginary part at 0 should not be considered complex at all.
ERROR LOG:
----------
HOW TO REPRODUCE THE BUG:
-------------------------
isreal( 0*%i ) // should be true
0*%i <= 1 // should be true and not a call to overload
OTHER INFORMATION:
------------------