zeroripple.gms : Zero Ripple Test

Description

Test result of one-argument functions when input is zero.

Contributor: M. Bussieck, September 2019


Small Model of Type : GAMS


Category : GAMS Test library


Main file : zeroripple.gms

$title Zero Ripple Test (ZERORIPPLE,SEQ=803)

$onText
Test result of one-argument functions when input is zero.

Contributor: M. Bussieck, September 2019
$offText


scalar x;
* Functions with univariate flavor and zeroRipple=true better result in 0 when called with argument 0
$onEchoV > "%gams.scrDir%zr1.%gams.scrExt%"
x = ceil(%1);          abort$(x<>0) 'ceil(%1);         ', x;
x = floor(%1);         abort$(x<>0) 'floor(%1);        ', x;
x = round(%1);         abort$(x<>0) 'round(%1);        ', x;
x = trunc(%1);         abort$(x<>0) 'trunc(%1);        ', x;
x = sign(%1);          abort$(x<>0) 'sign(%1);         ', x;
x = sqr(%1);           abort$(x<>0) 'sqr(%1);          ', x;
x = sqrt(%1);          abort$(x<>0) 'sqrt(%1);         ', x;
x = abs(%1);           abort$(x<>0) 'abs(%1);          ', x;
x = sin(%1);           abort$(x<>0) 'sin(%1);          ', x;
x = arctan(%1);        abort$(x<>0) 'arctan(%1);       ', x;
x = frac(%1);          abort$(x<>0) 'frac(%1);         ', x;
x = Entropy(%1);       abort$(x<>0) 'Entropy(%1);      ', x;
x = sinh(%1);          abort$(x<>0) 'sinh(%1);         ', x;
x = tanh(%1);          abort$(x<>0) 'tanh(%1);         ', x;
x = tan(%1);           abort$(x<>0) 'tan(%1);          ', x;
x = arcsin(%1);        abort$(x<>0) 'arcsin(%1);       ', x;
x = JobStatus(%1);     abort$(x<>0) 'JobStatus(%1);    ', x;
x = JobKill(%1);       abort$(x<>0) 'JobKill(%1);      ', x;
x = JobTerminate(%1);  abort$(x<>0) 'JobTerminate(%1); ', x;
x = gdow(%1);          abort$(x<>0) 'gdow(%1);         ', x;
x = gleap(%1);         abort$(x<>0) 'gleap(%1);        ', x;
x = ghour(%1);         abort$(x<>0) 'ghour(%1);        ', x;
x = gminute(%1);       abort$(x<>0) 'gminute(%1);      ', x;
x = gsecond(%1);       abort$(x<>0) 'gsecond(%1);      ', x;
x = EDist(%1);         abort$(x<>0) 'EDist(%1);        ', x; 
x = Gmillisec(%1);     abort$(x<>0) 'Gmillisec(%1);    ', x; 

* Functions with univariate flavor and zeroRipple=false better result in ~0 when called with argument 0
x = exp(%1);             abort$(x=0) 'exp(%1);     ';      
x = cos(%1);             abort$(x=0) 'cos(%1);     ';      
x = errorf(%1);          abort$(x=0) 'errorf(%1);  ';   
x = gyear(%1);           abort$(x=0) 'gyear(%1);   ';    
x = gmonth(%1);          abort$(x=0) 'gmonth(%1);  ';   
x = gday(%1);            abort$(x=0) 'gday(%1);    ';     
x = Fact(%1);            abort$(x=0) 'Fact(%1);    ';     
x = Sigmoid(%1);         abort$(x=0) 'Sigmoid(%1); ';  
x = sllog10(%1);         abort$(x=0) 'sllog10(%1); ';  
x = sqlog10(%1);         abort$(x=0) 'sqlog10(%1); ';  
x = slexp(%1);           abort$(x=0) 'slexp(%1);   ';    
x = sqexp(%1);           abort$(x=0) 'sqexp(%1);   ';    
x = slrec(%1);           abort$(x=0) 'slrec(%1);   ';    
x = sqrec(%1);           abort$(x=0) 'sqrec(%1);   ';    
x = cosh(%1);            abort$(x=0) 'cosh(%1);    ';        
x = arccos(%1);          abort$(x=0) 'arccos(%1);  ';
$offEcho
$batInclude "%gams.scrDir%zr1.%gams.scrExt%" 0
$batInclude "%gams.scrDir%zr1.%gams.scrExt%" EPS

** These functions produce an error when called with argument 0, so we skip the test
**x = log(0);          abort$(x=0) 'log(0);         ';      
**x = log10(0);        abort$(x=0) 'log10(0);       ';    
**x = log2(0);         abort$(x=0) 'log2(0);        ';     
**x = Gamma(0);        abort$(x=0) 'Gamma(0);       ';    
**x = LogGamma(0);     abort$(x=0) 'LogGamma(0);    '; 
**x = HandleSubmit(0); abort$(x=0) 'HandleSubmit(0);';
**x = HandleDelete(0); abort$(x=0) 'HandleDelete(0);';

** sleep(0) has some side effects (https://stackoverflow.com/questions/3727420/significance-of-sleep0),
** so we want this to be actually called with arg 0
**x = sleep(0);        abort$(x=0) 'sleep(0);       ';

** These functions distiguish between 0 and eps and hence we better leave zeroRipple=false even if they return 0 for 0
**x = bool_not(eps|0);      abort$(x=0) 'bool_not(eps|0);'; 
**x = HandleStatus(eps|0);  abort$(x=0) 'HandleStatus(eps|0); '; 
**x = HandleCollect(eps|0); abort$(x=0) 'HandleCollect(eps|0);'; 
**x = mapval(eps|0);        abort$(x=0) 'mapval(eps|0);';