added -lm to compile