#define swap(a,b) { tmp=(a); (a)=(b); (b)=tmp; }
#define swap1(a,b) { tmp1=(a); (a)=(b); (b)=tmp1; }
#define swap2(a,b) { tmp2=(a); (a)=(b); (b)=tmp2; }
#define swap3(a,b) { tmp3=(a); (a)=(b); (b)=tmp3; }
#define sinc(x) (((x)==0.0) ? (1.0) : (sin(x)/(x)))
#define sigmoid(x) (1.0/(1.0+exp(-(x))))

실수에 가장 가까운 정수
#define nint(x) (((x)>=0.0) ? ((int)((x)+0.5)):((int)((x)-0.5)))

#define modulus(x,mod) (((x)>=0) ? ((x)%(mod)):((abs(mod)-1)-((-(x)-1)%(mod))))
#define gray_level(red,green,blue) (0.299*(red)+0.587*(green)+0.114*(blue))

nint + clipping 
#define clip_nint(lower,upper,x) (((x)<(lower)) ? (lower):(min((upper),nint(x))))
#define clip(lower,upper,x) (((x)<(lower)) ? (lower):(min((upper),(x))))

#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

추후 update 예정 
Posted by 우주여행가
,