In this article we will discuss why abs() on local computer works as expected, i.e. produces floating point results, but on server the end results are truncated to an integer.
On Local the results are as below:
On server the results are as below:
Basically this occurs as developers tend to overlook the impact of overloading of functions in C++. C defines abs() function in the header file
While calling and overloaded function like abs() in C++, you have to ensure that you include the correct header. There are two options for these:
On a side note, always enable all warning while compiling to catch these errors early.