I couldn't find a way testing for a function, so I guess you could adopt a methodology similar to what you might do with c files. Here I create a variable with the same name as my function (no conflict):
if(ISNA(MYCUBEROOT)) // Here is my test { ty Need to define it; @global = 1; function double MyCubeRoot(double dVar) { int MyCubeRoot = 1; if(dVar < 0) return -10^(log(abs(dVar))/3); else return 10^(log(dVar)/3); } @global = 0; } else ty Been there, done that.;
That's a good idea. In fact, you don't even need to define a variable of the same name. The function name itself shows up globally. So you can just do the
if (ISNA(MYCUBEROOT)) {...}
using the function name itself.
Except, this technique doesn't quite work perfectly. The fist time you run it (and it is the same with the demo code Greg provided), you get an "Undefined variable: MYCUBEROOT" error in the Message Log.