Fixed a llmvm compiler issue - ambiguous call to abs

Had to recreate the pull request to remove the redundant commit.

Also updated to use cost_t instead of float.