[Scilab-users] How to overload "double" function ?

philippe rouxph.22 at gmail.com
Tue Aug 21 17:11:12 CEST 2018


Hi,

I want to overload some usual scilab functions, I made it for abs and
sign but strangely it doesn't work for double ! Let's take an example ,
I want to extend sign and double for polynomials  :

--> X=poly(0,"x"); // a polynomial

--> sign(X)
dans la fonction native        sign

Fonction non définie pour les types fournis.
  vérifier les arguments ou définir la fonction %p_sign pour la surcharge.

--> double(X)

double : Types erronés des arguments d'entrée : entiers, booléens ou
réels attendus.


so I define overloading for the two functions and "p" type :

 function y=%p_sign(x)
     y="OK"
 endfunction

 function y=%p_double(x)
    y="OK"
 endfunction

Now I can call sign on a polynomial, but this doesn't work for double

--> sign(X)
 ans  =

 OK


--> double(X)

double : Types erronés des arguments d'entrée : entiers, booléens ou
réels attendus.

How can I do this for double ? If not why this doesn't work ? Both sign
and double are "fptr" type , I thought that scilab-6 doesn't make
difference between function and fptr any more .

Philippe




More information about the users mailing list