//+++++++++++++++++++++++++++++++++++++++++++++++++++++
// File automatically generated by Xfuzzy - DO NOT EDIT
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
package pkg.xfsg.crisp;
import xfuzzy.lang.*;
public class diffRad extends CrispBlock {
public diffRad() {
super("xfsg","diffRad");
Parameter single[] = new Parameter[0];
setSingleParameters(single);
}
public double compute(double[] x) {
double d = x[0] - x[1];
if(d>Math.PI) d -= 2*Math.PI;
if(d<-Math.PI) d += 2*Math.PI;
return d;
}
public int inputs() {
return 2;
}
public boolean test () {
return true;
}
public String getJavaCode() {
String eol = System.getProperty("line.separator", "\n");
String code = "";
code += " double d = x[0] - x[1];"+eol;
code += " if(d>Math.PI) d -= 2*Math.PI;"+eol;
code += " if(d<-Math.PI) d += 2*Math.PI;"+eol;
code += " return d;"+eol;
return code;
}
public String getCCode() {
String eol = System.getProperty("line.separator", "\n");
String code = "";
code += " double d = x[0] - x[1];"+eol;
code += " if(d>M_PI) d -= 2*M_PI;"+eol;
code += " if(d<-M_PI) d += 2*M_PI;"+eol;
code += " return d;"+eol;
return code;
}
public String getCppCode() {
String eol = System.getProperty("line.separator", "\n");
String code = "";
code += " double d = x[0] - x[1];"+eol;
code += " if(d>M_PI) d -= 2*M_PI;"+eol;
code += " if(d<-M_PI) d += 2*M_PI;"+eol;
code += " return d;"+eol;
return code;
}
}