[Scilab-users] strange error with "rat"

sgougeon at free.fr sgougeon at free.fr
Fri Sep 2 14:32:00 CEST 2016


Hello Philippe,

Le 2016-09-02 13:10, philippe a écrit :
> Hi to all,
> 
> 
> I use rat to do integer simplifications in vectors (if possible).  I 
> use
> it like this
> 
> -->[n,d]=rat(2/14)
>  d  =
> 
>     7.
>  n  =
> 
>     1.
> 
> but I have a strnage error when rat is called  from another (very
> complex) function :
> 
> 
> ***********************************************
> 
> -->[D,P,txt]=diagonalisation(A,'txt', variables, 'M')
> 
>  !--error 246
> Fonction non définie pour le type d'argument donné,
>   Vérifier les arguments ou définir la fonction %s_rat pour la 
> surcharge.
> at line      38 of function vector2int called by :
> at line      95 of function matrix2noyau called by :
> at line      61 of function eigenvector called by :
> at line      83 of function diagonalisation called by :
> ********************************************************
> 
> I've checked that the argument of rat is a constant (it's -1/2), but I
> can't reproduce the bug out of this context!?!?
> 
> Does anyone have any idea of what could have happened ?

When the %s_ overload is called, it is often due to some unsupported
complex values (even with null imaginary parts: only the encoding 
matters).
So, you may check before calling rat() that its input argument is not
of complex type , with isreal(x).

HTH
Samuel



More information about the users mailing list