title: Adding floats with gmp gives "correct" results, sort of
body: <p>In the code below I use <code>mpf_add</code> to add the string representation of two floating values. What I don't understand at this point is why <code>2.2 + 3.2 = 5.39999999999999999999999999999999999999</code>. I would have thought that <code>gmp</code> was smart enough to give <code>5.4</code>. </p>
  
  <p>What am I not comprehending about how gmp does floats?</p>
  
  <p>(BTW, when I first wrote this I wasn't sure how to insert a decimal point, thus the plus/minus digit stuff at the end)</p>
  
  <pre><code>BSTR __stdcall FBIGSUM(BSTR p1, BSTR p2 ) {
    USES_CONVERSION;
  
    F(n1);
    F(n2);
    F(res);
  
    LPSTR sNum1 = W2A( p1 );
    LPSTR sNum2 = W2A( p2 );
  
    mpf_set_str( n1, sNum1, 10 );
    mpf_set_str( n2, sNum2, 10 );
  
    mpf_add( res, n1, n2 );
  
    char * buff =  (char *) _alloca( 1024 );
    char expBuffer[ 20 ];
    mp_exp_t exp;
  
    mpf_get_str(buff, &amp;exp, 10, 0, res);
  
    char * temp = ltoa( (long) exp, expBuffer, 10 );
    if (exp &gt;= 0) {
      strcat(buff, "+" );
    }
    strcat(buff, expBuffer );
  
    BSTR bResult = _com_util::ConvertStringToBSTR( buff );
    return bResult;
  }
  </code></pre>