Added funcapprox code