How to define signum function

I want to define sgn(x)=1 for x>=0 and sgn(x)=-1 for x<0. How can I define this at starting of my program in freefem.

Many ways to do so. for example

func sgn = (x >=0 ? 1.0 : -1.0);

or also

func real sgn(real xx) = (xx >=0 ? 1.0 : -1.0);

or via macros

macro sgn(xx) (( xx >=0 ? 1.0 : -1.0 )) // EOM

Thank you so much for your help!

the freefem++ sign do this in c++
// c++ code …
double sign(double x){return (x>0.)-(x<0.); }// Add FH jan 2018

real s= sign(1);