This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pow(int , int)


this send me an error!

for (i = 0; i < 32; i++)
  {
    cout << "2^" << dec << i << " = 0x" << hex << 
    pow(2, i) << endl;
  }


exponencial.cpp:19: call of overloaded `pow(int,
int&)' is ambiguous
/usr/include/math.h:60: candidates are: double
pow(double, double)
/usr/include/c++/3.2/cmath:427:                 long
double std::pow(long
   double, int)
/usr/include/c++/3.2/cmath:423:                 float
std::pow(float, int)
/usr/include/c++/3.2/cmath:419:                 double
std::pow(double, int)
/usr/include/c++/3.2/cmath:414:                 long
double std::pow(long
   double, long double)
/usr/include/c++/3.2/cmath:401:                 float
std::pow(float, float)
make: *** [exponencial] Error 1

--------------------------------------------
but this works fine....

for (i = 0; i < 32; i++)
  {
    cout << "2^" << dec << i << " = 0x" << hex << 
     pow(2.0, i) << endl;
  }


so my question is :

pow( ) does not support pow(int, int); ?

just :
  
long double std::pow(long double, int)
 float std::pow(float, int)
double std::pow(double, int)
long double std::pow(long double, long double)
 float std::pow(float, float)


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]