• + 1 comment

    Why do you want to reinvent the wheel ? The use of 'std::abs' is totally justified here and make the code shorter and clearer.

    And by not using another variable, your code is absolutly incomprehensible.