diff --git a/miscmaths.h b/miscmaths.h index ac850932af009be2c8e30cf52539ac929dde7652..033673bf2cd48d21a9c6c38b2628e7a7aa38c2ae 100644 --- a/miscmaths.h +++ b/miscmaths.h @@ -71,8 +71,7 @@ namespace MISCMATHS { int round(double x); template<class T> - inline int sign(T x){ if(x!=0) return int(x / abs(x)); - else return 1; } + inline int sign(T x){ if (x>0) return 1; else { if (x<0) return -1; else return 0; } } inline double pow(double x, float y) { return std::pow(x,(double) y); } inline double pow(float x, double y) { return std::pow((double) x,y); }