title: Ambiguous overload call to abs(double)
body: <p>I have the following C++ code:</p>
  
  <pre><code>#include &lt;math.h&gt;
  #include &lt;cmath.h&gt;      // per http://www.cplusplus.com/reference/clibrary/cmath/abs/
  
  // snip ...
  
  if ( (loan_balance &lt; 0) &amp;&amp; (abs(loan_balance) &gt; loan_payment) ) {
      ...
  }
  </code></pre>
  
  <p>and <code>make</code> blows up on:</p>
  
  <pre><code>error: call of overloaded 'abs(double)' is ambiguous
  </code></pre>
  
  <p>also of interest:</p>
  
  <pre><code>/usr/include/stdlib.h:785: note: candidates are: int abs(int)
  </code></pre>
  
  <p><strong>How can I specify that the compiler needs to call the abs() in cmath.h that can handle floats?</strong></p>
  
  <p>Compiler info (Not sure if this matters):</p>
  
  <pre><code>[some_man@some_box ~/some_code]#  gcc -v
  Using built-in specs.
  Target: i386-redhat-linux
  Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr    /share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
  Thread model: posix
  gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)
  </code></pre>