[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#585430: Problem of performance of pow operator in libm library on x86_64 architecture (etch or lenny)



Package: libc6
Status: install ok installed
Installed-Size: 11456
Architecture: amd64
Version: 2.7-18lenny2

As demonstrated by attached sample case.cc, "pow" operator evaluation, in the case it calls "slow_pow" method, is showing very poor performances. This problem does'nt occur on 32 bits architectures but on 64 bits ones (lenny and etch). Up to now, I have bypassed this problem using amd library amdlibm instead of libc.
#include <stdio.h>
#ifdef AMDLIBM
# include <amdlibm.h>
#define ::pow amdpow
#else
# include <math.h>
#endif


//#define pow(x,y) exp(y*log(x))
int main(){ 
   double x,x0=1.00000000000002;
   x = x0;
   
   int i; 
   for( i=1; i<1000; i++ ) { 
      if( x > x0 ) x = x0 ;
      x = ::pow( x, 1.05 );
        
   } 
   printf( "x = %1.30f\n", x ); 
}


Reply to: