funnyHatFunc function

double funnyHatFunc(
  1. double x
)

Implementation

double funnyHatFunc(double x) {
  double x2=x*x;
  if (x>=0)
  {
    if(x>=1.6)
    {
      return -0.16*x+0.104;
    }
    return 0.5*x*x2-1.25*x2+1;
  }
  if(x<=-3.3)
  {
    return 0.033*x-0.7424;
  }
  return 1-0.1*x*x2-0.5*x2;
}