replaced abs calls with llabs calls to avoid data loss (thanks clang)