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

Samuel Gougeon sgougeon at free.fr
Wed Aug 22 11:12:46 CEST 2018


Hello Philippe,

The overloading mechanism is not systematic. It is implemented (or not) 
function per function.
It is currently proposed for some of them, but not all of them.
If you need it for double(), you shall post a wish on Bugzilla.

Best regards
Samuel

PS: for instance, iconvert(p,0) makes the same as double(), and is 
overloadable:

--> iconvert(%z,0)
in builtin                iconvert

Function not defined for given argument type(s),
   check arguments or define function %p_iconvert for overloading.

Le 21/08/2018 à 17:11, philippe a écrit :
> 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
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


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


More information about the users mailing list