I'm running the following
test.cpp
#include <iostream>
#include <limits>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv) {
long value = numeric_limits<long>::min();
value = abs(value);
cout << value << endl;
}
Depending on what computer I compile and run the program on, I'm getting different results.
Either I get:
abs(numeric_limits<long>::min())
Or I get:
numeric_limits<long>::min()
In the latter case, abs() doesn't seem to be performed. I'm wondering what accounts for this difference and how I should accommodate it. Should I compute abs() in a different way?