Apifun  

Issue 633: apifun_checkgreq may produce a wrong error message

Reported by Michael Baudin, Jan 14, 2012

apifun_checkgreq may produce a wrong error message

The script 

a = 1:6
b = (1:6)^-1
apifun_checkgreq( "myfun" , b , "b" , 2 , a )

produces

 !--error 999 
msprintf: Mauvais nombre d'arguments d'entrée: les données ne 
correspondent pas au format.
at line      81 of function apifun_checkgreq called by :  
apifun_checkgreq( "myfun" , b , "b" , 2 , a )

Comment 1 by Michael Baudin, Jan 14, 2012

In the script in attachment, we have added :

  if ( or(size(var) <> size(thr)) ) then
    errmsg = msprintf(gettext("%s: Incompatible input arguments 
#%d and #%d: Same sizes expected.\n"), 
"apifun_checkgreq", "ivar" , 3 , 5 );
    error(errmsg)
  end
  //
  errmsg = []
  if ( or ( var < thr ) ) then
    k = find ( var < thr )
    k = k(1)
    if ( size(thr,"*")==1) then
    errmsg = msprintf(gettext("%s: Expected that all entries of 
input argument %s at input #%d are greater or equal than %s, but 
entry #%d is equal to 
%s."),funname,varname,ivar,string(thr),k,string(var(k)));
    else
    errmsg = msprintf(gettext("%s: Expected that entry #%d of 
input argument %s at input #%d is greater or equal than %s, but 
entry #%d is equal to 
%s."),funname,k,varname,ivar,string(thr(k)),k,string(var(k)));
    end
    error(errmsg);
  end

Moreover, the function now checks that var and thr have the same 
size:

-->apifun_checkgreq( "myfun" , 1 , "b" , 2 , 
[1 2 3] )
 !--error 10000 
apifun_checkgreq : Arguments d''entrée n°3 et n°5 incompatibles : 
Même dimension attendue.
at line      77 of function apifun_checkgreq called by :  
apifun_checkgreq( "myfun" , 1 , "b" , 2 , [1 2 
3] )

Comment 2 by Michael Baudin, Jan 14, 2012

A better script.

Comment 3 by Michael Baudin, Sep 8, 2012

Fixed at :

http://forge.scilab.org/index.php/p/apifun/source/commit/64/
Status: Fixed

Comment 4 by martin garix, Dec 1, 2018

Install bing application from microsoft store,then invite your 
friends and other http://bingrewards.info this is right place to 
download this app.

Created: 6 years 10 months ago by Michael Baudin

Updated: 12 days 2 hours ago

Status: Fixed

Followed by: 1 person

Labels:
Type:Defect
Priority:Medium

This issue duplicates
867 - api...es not take row vectors.